Fossil SCM

The common xfer script should only be run once for each interpreter.

jan.nijtmans 2013-10-15 07:45 UTC tkt-change-hook
Commit 55fe2bb814ae65848ed38a4c1e366d4729113b7f
2 files changed +1 -4 +10 -14
+1 -4
--- src/manifest.c
+++ src/manifest.c
@@ -2037,14 +2037,11 @@
20372037
);
20382038
blob_reset(&comment);
20392039
}
20402040
db_end_transaction(0);
20412041
if( flags & MC_PERMIT_HOOKS ){
2042
- result = (xfer_run_common_script()==TH_OK);
2043
- if( result ){
2044
- result = (xfer_run_script(zScript, zUuid)==TH_OK);
2045
- }
2042
+ result = (xfer_run_script(zScript, zUuid)==TH_OK);
20462043
}
20472044
if( p->type==CFTYPE_MANIFEST ){
20482045
manifest_cache_insert(p);
20492046
}else{
20502047
manifest_destroy(p);
20512048
--- src/manifest.c
+++ src/manifest.c
@@ -2037,14 +2037,11 @@
2037 );
2038 blob_reset(&comment);
2039 }
2040 db_end_transaction(0);
2041 if( flags & MC_PERMIT_HOOKS ){
2042 result = (xfer_run_common_script()==TH_OK);
2043 if( result ){
2044 result = (xfer_run_script(zScript, zUuid)==TH_OK);
2045 }
2046 }
2047 if( p->type==CFTYPE_MANIFEST ){
2048 manifest_cache_insert(p);
2049 }else{
2050 manifest_destroy(p);
2051
--- src/manifest.c
+++ src/manifest.c
@@ -2037,14 +2037,11 @@
2037 );
2038 blob_reset(&comment);
2039 }
2040 db_end_transaction(0);
2041 if( flags & MC_PERMIT_HOOKS ){
2042 result = (xfer_run_script(zScript, zUuid)==TH_OK);
 
 
 
2043 }
2044 if( p->type==CFTYPE_MANIFEST ){
2045 manifest_cache_insert(p);
2046 }else{
2047 manifest_destroy(p);
2048
+10 -14
--- src/xfer.c
+++ src/xfer.c
@@ -852,13 +852,22 @@
852852
853853
/*
854854
** Run the specified TH1 script, if any, and returns 1 on error.
855855
*/
856856
int xfer_run_script(const char *zScript, const char *zUuid){
857
+ static int commonScriptRan = 0;
857858
int result;
859
+ if( !commonScriptRan ){
860
+ Th_FossilInit(TH_INIT_DEFAULT);
861
+ result = Th_Eval(g.interp, 0, xfer_common_code(), -1);
862
+ if( result!=TH_OK ){
863
+ fossil_error(1, "%s", Th_GetResult(g.interp, 0));
864
+ return result;
865
+ }
866
+ commonScriptRan = 1;
867
+ }
858868
if( !zScript ) return TH_OK;
859
- Th_FossilInit(TH_INIT_DEFAULT);
860869
if( zUuid ){
861870
result = Th_SetVar(g.interp, "uuid", -1, zUuid, -1);
862871
if( result!=TH_OK ){
863872
fossil_error(1, "%s", Th_GetResult(g.interp, 0));
864873
return result;
@@ -869,18 +878,10 @@
869878
fossil_error(1, "%s", Th_GetResult(g.interp, 0));
870879
}
871880
return result;
872881
}
873882
874
-/*
875
-** Runs the pre-transfer TH1 script, if any, and returns its return code.
876
-*/
877
-int xfer_run_common_script(void){
878
- Th_FossilInit(TH_INIT_DEFAULT);
879
- return xfer_run_script(xfer_common_code(), 0);
880
-}
881
-
882883
/*
883884
** If this variable is set, disable login checks. Used for debugging
884885
** only.
885886
*/
886887
static int disableLogin = 0;
@@ -936,15 +937,10 @@
936937
db_begin_transaction();
937938
db_multi_exec(
938939
"CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
939940
);
940941
manifest_crosslink_begin();
941
- if( xfer_run_common_script()!=TH_OK ){
942
- cgi_reset_content();
943
- @ error common\sscript\sfailed:\s%F(Th_GetResult(g.interp, 0))
944
- nErr++;
945
- }
946942
while( blob_line(xfer.pIn, &xfer.line) ){
947943
if( blob_buffer(&xfer.line)[0]=='#' ) continue;
948944
if( blob_size(&xfer.line)==0 ) continue;
949945
xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
950946
951947
--- src/xfer.c
+++ src/xfer.c
@@ -852,13 +852,22 @@
852
853 /*
854 ** Run the specified TH1 script, if any, and returns 1 on error.
855 */
856 int xfer_run_script(const char *zScript, const char *zUuid){
 
857 int result;
 
 
 
 
 
 
 
 
 
858 if( !zScript ) return TH_OK;
859 Th_FossilInit(TH_INIT_DEFAULT);
860 if( zUuid ){
861 result = Th_SetVar(g.interp, "uuid", -1, zUuid, -1);
862 if( result!=TH_OK ){
863 fossil_error(1, "%s", Th_GetResult(g.interp, 0));
864 return result;
@@ -869,18 +878,10 @@
869 fossil_error(1, "%s", Th_GetResult(g.interp, 0));
870 }
871 return result;
872 }
873
874 /*
875 ** Runs the pre-transfer TH1 script, if any, and returns its return code.
876 */
877 int xfer_run_common_script(void){
878 Th_FossilInit(TH_INIT_DEFAULT);
879 return xfer_run_script(xfer_common_code(), 0);
880 }
881
882 /*
883 ** If this variable is set, disable login checks. Used for debugging
884 ** only.
885 */
886 static int disableLogin = 0;
@@ -936,15 +937,10 @@
936 db_begin_transaction();
937 db_multi_exec(
938 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
939 );
940 manifest_crosslink_begin();
941 if( xfer_run_common_script()!=TH_OK ){
942 cgi_reset_content();
943 @ error common\sscript\sfailed:\s%F(Th_GetResult(g.interp, 0))
944 nErr++;
945 }
946 while( blob_line(xfer.pIn, &xfer.line) ){
947 if( blob_buffer(&xfer.line)[0]=='#' ) continue;
948 if( blob_size(&xfer.line)==0 ) continue;
949 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
950
951
--- src/xfer.c
+++ src/xfer.c
@@ -852,13 +852,22 @@
852
853 /*
854 ** Run the specified TH1 script, if any, and returns 1 on error.
855 */
856 int xfer_run_script(const char *zScript, const char *zUuid){
857 static int commonScriptRan = 0;
858 int result;
859 if( !commonScriptRan ){
860 Th_FossilInit(TH_INIT_DEFAULT);
861 result = Th_Eval(g.interp, 0, xfer_common_code(), -1);
862 if( result!=TH_OK ){
863 fossil_error(1, "%s", Th_GetResult(g.interp, 0));
864 return result;
865 }
866 commonScriptRan = 1;
867 }
868 if( !zScript ) return TH_OK;
 
869 if( zUuid ){
870 result = Th_SetVar(g.interp, "uuid", -1, zUuid, -1);
871 if( result!=TH_OK ){
872 fossil_error(1, "%s", Th_GetResult(g.interp, 0));
873 return result;
@@ -869,18 +878,10 @@
878 fossil_error(1, "%s", Th_GetResult(g.interp, 0));
879 }
880 return result;
881 }
882
 
 
 
 
 
 
 
 
883 /*
884 ** If this variable is set, disable login checks. Used for debugging
885 ** only.
886 */
887 static int disableLogin = 0;
@@ -936,15 +937,10 @@
937 db_begin_transaction();
938 db_multi_exec(
939 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
940 );
941 manifest_crosslink_begin();
 
 
 
 
 
942 while( blob_line(xfer.pIn, &xfer.line) ){
943 if( blob_buffer(&xfer.line)[0]=='#' ) continue;
944 if( blob_size(&xfer.line)==0 ) continue;
945 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
946
947

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button