Fossil SCM

Delay activation of ticket hook until after the ticket tables have been rebuilt.

mistachkin 2014-01-14 00:10 trunk merge
Commit 42316a14e27cdebaa6909b84a602e38a4d99de70
+27 -11
--- src/manifest.c
+++ src/manifest.c
@@ -1494,18 +1494,30 @@
14941494
#endif /* LOCAL_INTERFACE */
14951495
14961496
/*
14971497
** Finish up a sequence of manifest_crosslink calls.
14981498
*/
1499
-void manifest_crosslink_end(void){
1499
+int manifest_crosslink_end(int flags){
15001500
Stmt q, u;
15011501
int i;
1502
+ int rc = TH_OK;
1503
+ int permitHooks = (flags & MC_PERMIT_HOOKS);
1504
+ const char *zScript = 0;
15021505
assert( manifest_crosslink_busy==1 );
1506
+ if( permitHooks ){
1507
+ rc = xfer_run_common_script();
1508
+ if( rc==TH_OK ){
1509
+ zScript = xfer_ticket_code();
1510
+ }
1511
+ }
15031512
db_prepare(&q, "SELECT uuid FROM pending_tkt");
15041513
while( db_step(&q)==SQLITE_ROW ){
15051514
const char *zUuid = db_column_text(&q, 0);
15061515
ticket_rebuild_entry(zUuid);
1516
+ if( permitHooks && rc==TH_OK ){
1517
+ rc = xfer_run_script(zScript, zUuid);
1518
+ }
15071519
}
15081520
db_finalize(&q);
15091521
db_multi_exec("DROP TABLE pending_tkt");
15101522
15111523
/* If multiple check-ins happen close together in time, adjust their
@@ -1536,10 +1548,11 @@
15361548
"DROP TABLE time_fudge;"
15371549
);
15381550
15391551
db_end_transaction(0);
15401552
manifest_crosslink_busy = 0;
1553
+ return ( rc!=TH_ERROR );
15411554
}
15421555
15431556
/*
15441557
** Make an entry in the event table for a ticket change artifact.
15451558
*/
@@ -1657,14 +1670,15 @@
16571670
** Processing for other control artifacts was added later. The name
16581671
** of the routine, "manifest_crosslink", and the name of this source
16591672
** file, is a legacy of its original use.
16601673
*/
16611674
int manifest_crosslink(int rid, Blob *pContent, int flags){
1662
- int i, result = TH_OK;
1675
+ int i, rc = TH_OK;
16631676
Manifest *p;
16641677
Stmt q;
16651678
int parentid = 0;
1679
+ int permitHooks = (flags & MC_PERMIT_HOOKS);
16661680
const char *zScript = 0;
16671681
const char *zUuid = 0;
16681682
16691683
if( (p = manifest_cache_find(rid))!=0 ){
16701684
blob_reset(pContent);
@@ -1685,11 +1699,13 @@
16851699
fossil_error(1, "cannot fetch baseline manifest");
16861700
return 0;
16871701
}
16881702
db_begin_transaction();
16891703
if( p->type==CFTYPE_MANIFEST ){
1690
- zScript = xfer_commit_code();
1704
+ if( permitHooks ){
1705
+ zScript = xfer_commit_code();
1706
+ }
16911707
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
16921708
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
16931709
char *zCom;
16941710
for(i=0; i<p->nParent; i++){
16951711
int pid = uuid_to_rid(p->azParent[i], 1);
@@ -1883,12 +1899,10 @@
18831899
}
18841900
}
18851901
if( p->type==CFTYPE_TICKET ){
18861902
char *zTag;
18871903
1888
- zScript = xfer_ticket_code();
1889
- zUuid = p->zTicketUuid;
18901904
assert( manifest_crosslink_busy==1 );
18911905
zTag = mprintf("tkt-%s", p->zTicketUuid);
18921906
tag_insert(zTag, 1, 0, rid, p->rDate, rid);
18931907
free(zTag);
18941908
db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)",
@@ -1968,11 +1982,13 @@
19681982
zTagUuid);
19691983
branchMove = 0;
19701984
if( db_exists("SELECT 1 FROM event, blob"
19711985
" WHERE event.type='ci' AND event.objid=blob.rid"
19721986
" AND blob.uuid='%s'", zTagUuid) ){
1973
- zScript = xfer_commit_code();
1987
+ if( permitHooks ){
1988
+ zScript = xfer_commit_code();
1989
+ }
19741990
zUuid = zTagUuid;
19751991
}
19761992
}
19771993
zName = p->aTag[i].zName;
19781994
zValue = p->aTag[i].zValue;
@@ -2042,23 +2058,23 @@
20422058
p->rDate, rid, p->zUser, blob_str(&comment)+1
20432059
);
20442060
blob_reset(&comment);
20452061
}
20462062
db_end_transaction(0);
2047
- if( zScript && (flags & MC_PERMIT_HOOKS) ){
2048
- result = xfer_run_common_script();
2049
- if( result==TH_OK ){
2050
- result = xfer_run_script(zScript, zUuid);
2063
+ if( permitHooks ){
2064
+ rc = xfer_run_common_script();
2065
+ if( rc==TH_OK ){
2066
+ rc = xfer_run_script(zScript, zUuid);
20512067
}
20522068
}
20532069
if( p->type==CFTYPE_MANIFEST ){
20542070
manifest_cache_insert(p);
20552071
}else{
20562072
manifest_destroy(p);
20572073
}
20582074
assert( blob_is_reset(pContent) );
2059
- return ( result!=TH_ERROR );
2075
+ return ( rc!=TH_ERROR );
20602076
}
20612077
20622078
/*
20632079
** COMMAND: test-crosslink
20642080
**
20652081
--- src/manifest.c
+++ src/manifest.c
@@ -1494,18 +1494,30 @@
1494 #endif /* LOCAL_INTERFACE */
1495
1496 /*
1497 ** Finish up a sequence of manifest_crosslink calls.
1498 */
1499 void manifest_crosslink_end(void){
1500 Stmt q, u;
1501 int i;
 
 
 
1502 assert( manifest_crosslink_busy==1 );
 
 
 
 
 
 
1503 db_prepare(&q, "SELECT uuid FROM pending_tkt");
1504 while( db_step(&q)==SQLITE_ROW ){
1505 const char *zUuid = db_column_text(&q, 0);
1506 ticket_rebuild_entry(zUuid);
 
 
 
1507 }
1508 db_finalize(&q);
1509 db_multi_exec("DROP TABLE pending_tkt");
1510
1511 /* If multiple check-ins happen close together in time, adjust their
@@ -1536,10 +1548,11 @@
1536 "DROP TABLE time_fudge;"
1537 );
1538
1539 db_end_transaction(0);
1540 manifest_crosslink_busy = 0;
 
1541 }
1542
1543 /*
1544 ** Make an entry in the event table for a ticket change artifact.
1545 */
@@ -1657,14 +1670,15 @@
1657 ** Processing for other control artifacts was added later. The name
1658 ** of the routine, "manifest_crosslink", and the name of this source
1659 ** file, is a legacy of its original use.
1660 */
1661 int manifest_crosslink(int rid, Blob *pContent, int flags){
1662 int i, result = TH_OK;
1663 Manifest *p;
1664 Stmt q;
1665 int parentid = 0;
 
1666 const char *zScript = 0;
1667 const char *zUuid = 0;
1668
1669 if( (p = manifest_cache_find(rid))!=0 ){
1670 blob_reset(pContent);
@@ -1685,11 +1699,13 @@
1685 fossil_error(1, "cannot fetch baseline manifest");
1686 return 0;
1687 }
1688 db_begin_transaction();
1689 if( p->type==CFTYPE_MANIFEST ){
1690 zScript = xfer_commit_code();
 
 
1691 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1692 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
1693 char *zCom;
1694 for(i=0; i<p->nParent; i++){
1695 int pid = uuid_to_rid(p->azParent[i], 1);
@@ -1883,12 +1899,10 @@
1883 }
1884 }
1885 if( p->type==CFTYPE_TICKET ){
1886 char *zTag;
1887
1888 zScript = xfer_ticket_code();
1889 zUuid = p->zTicketUuid;
1890 assert( manifest_crosslink_busy==1 );
1891 zTag = mprintf("tkt-%s", p->zTicketUuid);
1892 tag_insert(zTag, 1, 0, rid, p->rDate, rid);
1893 free(zTag);
1894 db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)",
@@ -1968,11 +1982,13 @@
1968 zTagUuid);
1969 branchMove = 0;
1970 if( db_exists("SELECT 1 FROM event, blob"
1971 " WHERE event.type='ci' AND event.objid=blob.rid"
1972 " AND blob.uuid='%s'", zTagUuid) ){
1973 zScript = xfer_commit_code();
 
 
1974 zUuid = zTagUuid;
1975 }
1976 }
1977 zName = p->aTag[i].zName;
1978 zValue = p->aTag[i].zValue;
@@ -2042,23 +2058,23 @@
2042 p->rDate, rid, p->zUser, blob_str(&comment)+1
2043 );
2044 blob_reset(&comment);
2045 }
2046 db_end_transaction(0);
2047 if( zScript && (flags & MC_PERMIT_HOOKS) ){
2048 result = xfer_run_common_script();
2049 if( result==TH_OK ){
2050 result = xfer_run_script(zScript, zUuid);
2051 }
2052 }
2053 if( p->type==CFTYPE_MANIFEST ){
2054 manifest_cache_insert(p);
2055 }else{
2056 manifest_destroy(p);
2057 }
2058 assert( blob_is_reset(pContent) );
2059 return ( result!=TH_ERROR );
2060 }
2061
2062 /*
2063 ** COMMAND: test-crosslink
2064 **
2065
--- src/manifest.c
+++ src/manifest.c
@@ -1494,18 +1494,30 @@
1494 #endif /* LOCAL_INTERFACE */
1495
1496 /*
1497 ** Finish up a sequence of manifest_crosslink calls.
1498 */
1499 int manifest_crosslink_end(int flags){
1500 Stmt q, u;
1501 int i;
1502 int rc = TH_OK;
1503 int permitHooks = (flags & MC_PERMIT_HOOKS);
1504 const char *zScript = 0;
1505 assert( manifest_crosslink_busy==1 );
1506 if( permitHooks ){
1507 rc = xfer_run_common_script();
1508 if( rc==TH_OK ){
1509 zScript = xfer_ticket_code();
1510 }
1511 }
1512 db_prepare(&q, "SELECT uuid FROM pending_tkt");
1513 while( db_step(&q)==SQLITE_ROW ){
1514 const char *zUuid = db_column_text(&q, 0);
1515 ticket_rebuild_entry(zUuid);
1516 if( permitHooks && rc==TH_OK ){
1517 rc = xfer_run_script(zScript, zUuid);
1518 }
1519 }
1520 db_finalize(&q);
1521 db_multi_exec("DROP TABLE pending_tkt");
1522
1523 /* If multiple check-ins happen close together in time, adjust their
@@ -1536,10 +1548,11 @@
1548 "DROP TABLE time_fudge;"
1549 );
1550
1551 db_end_transaction(0);
1552 manifest_crosslink_busy = 0;
1553 return ( rc!=TH_ERROR );
1554 }
1555
1556 /*
1557 ** Make an entry in the event table for a ticket change artifact.
1558 */
@@ -1657,14 +1670,15 @@
1670 ** Processing for other control artifacts was added later. The name
1671 ** of the routine, "manifest_crosslink", and the name of this source
1672 ** file, is a legacy of its original use.
1673 */
1674 int manifest_crosslink(int rid, Blob *pContent, int flags){
1675 int i, rc = TH_OK;
1676 Manifest *p;
1677 Stmt q;
1678 int parentid = 0;
1679 int permitHooks = (flags & MC_PERMIT_HOOKS);
1680 const char *zScript = 0;
1681 const char *zUuid = 0;
1682
1683 if( (p = manifest_cache_find(rid))!=0 ){
1684 blob_reset(pContent);
@@ -1685,11 +1699,13 @@
1699 fossil_error(1, "cannot fetch baseline manifest");
1700 return 0;
1701 }
1702 db_begin_transaction();
1703 if( p->type==CFTYPE_MANIFEST ){
1704 if( permitHooks ){
1705 zScript = xfer_commit_code();
1706 }
1707 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1708 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
1709 char *zCom;
1710 for(i=0; i<p->nParent; i++){
1711 int pid = uuid_to_rid(p->azParent[i], 1);
@@ -1883,12 +1899,10 @@
1899 }
1900 }
1901 if( p->type==CFTYPE_TICKET ){
1902 char *zTag;
1903
 
 
1904 assert( manifest_crosslink_busy==1 );
1905 zTag = mprintf("tkt-%s", p->zTicketUuid);
1906 tag_insert(zTag, 1, 0, rid, p->rDate, rid);
1907 free(zTag);
1908 db_multi_exec("INSERT OR IGNORE INTO pending_tkt VALUES(%Q)",
@@ -1968,11 +1982,13 @@
1982 zTagUuid);
1983 branchMove = 0;
1984 if( db_exists("SELECT 1 FROM event, blob"
1985 " WHERE event.type='ci' AND event.objid=blob.rid"
1986 " AND blob.uuid='%s'", zTagUuid) ){
1987 if( permitHooks ){
1988 zScript = xfer_commit_code();
1989 }
1990 zUuid = zTagUuid;
1991 }
1992 }
1993 zName = p->aTag[i].zName;
1994 zValue = p->aTag[i].zValue;
@@ -2042,23 +2058,23 @@
2058 p->rDate, rid, p->zUser, blob_str(&comment)+1
2059 );
2060 blob_reset(&comment);
2061 }
2062 db_end_transaction(0);
2063 if( permitHooks ){
2064 rc = xfer_run_common_script();
2065 if( rc==TH_OK ){
2066 rc = xfer_run_script(zScript, zUuid);
2067 }
2068 }
2069 if( p->type==CFTYPE_MANIFEST ){
2070 manifest_cache_insert(p);
2071 }else{
2072 manifest_destroy(p);
2073 }
2074 assert( blob_is_reset(pContent) );
2075 return ( rc!=TH_ERROR );
2076 }
2077
2078 /*
2079 ** COMMAND: test-crosslink
2080 **
2081
+1 -1
--- src/rebuild.c
+++ src/rebuild.c
@@ -412,11 +412,11 @@
412412
db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
413413
rebuild_step_done(rid);
414414
}
415415
}
416416
db_finalize(&s);
417
- manifest_crosslink_end();
417
+ manifest_crosslink_end(MC_NONE);
418418
rebuild_tag_trunk();
419419
if( ttyOutput && !g.fQuiet && totalSize>0 ){
420420
processCnt += incrSize;
421421
percent_complete((processCnt*1000)/totalSize);
422422
}
423423
--- src/rebuild.c
+++ src/rebuild.c
@@ -412,11 +412,11 @@
412 db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
413 rebuild_step_done(rid);
414 }
415 }
416 db_finalize(&s);
417 manifest_crosslink_end();
418 rebuild_tag_trunk();
419 if( ttyOutput && !g.fQuiet && totalSize>0 ){
420 processCnt += incrSize;
421 percent_complete((processCnt*1000)/totalSize);
422 }
423
--- src/rebuild.c
+++ src/rebuild.c
@@ -412,11 +412,11 @@
412 db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
413 rebuild_step_done(rid);
414 }
415 }
416 db_finalize(&s);
417 manifest_crosslink_end(MC_NONE);
418 rebuild_tag_trunk();
419 if( ttyOutput && !g.fQuiet && totalSize>0 ){
420 processCnt += incrSize;
421 percent_complete((processCnt*1000)/totalSize);
422 }
423
+6 -2
--- src/tkt.c
+++ src/tkt.c
@@ -535,13 +535,17 @@
535535
}else{
536536
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d);", rid);
537537
db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid);
538538
}
539539
manifest_crosslink_begin();
540
- result = (manifest_crosslink(rid, pTicket, MC_PERMIT_HOOKS)==0);
540
+ result = (manifest_crosslink(rid, pTicket, MC_NONE)==0);
541541
assert( blob_is_reset(pTicket) );
542
- manifest_crosslink_end();
542
+ if( !result ){
543
+ result = manifest_crosslink_end(MC_PERMIT_HOOKS);
544
+ }else{
545
+ manifest_crosslink_end(MC_NONE);
546
+ }
543547
return result;
544548
}
545549
546550
/*
547551
** Subscript command: submit_ticket
548552
--- src/tkt.c
+++ src/tkt.c
@@ -535,13 +535,17 @@
535 }else{
536 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d);", rid);
537 db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid);
538 }
539 manifest_crosslink_begin();
540 result = (manifest_crosslink(rid, pTicket, MC_PERMIT_HOOKS)==0);
541 assert( blob_is_reset(pTicket) );
542 manifest_crosslink_end();
 
 
 
 
543 return result;
544 }
545
546 /*
547 ** Subscript command: submit_ticket
548
--- src/tkt.c
+++ src/tkt.c
@@ -535,13 +535,17 @@
535 }else{
536 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d);", rid);
537 db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid);
538 }
539 manifest_crosslink_begin();
540 result = (manifest_crosslink(rid, pTicket, MC_NONE)==0);
541 assert( blob_is_reset(pTicket) );
542 if( !result ){
543 result = manifest_crosslink_end(MC_PERMIT_HOOKS);
544 }else{
545 manifest_crosslink_end(MC_NONE);
546 }
547 return result;
548 }
549
550 /*
551 ** Subscript command: submit_ticket
552
+15 -15
--- src/xfer.c
+++ src/xfer.c
@@ -852,25 +852,25 @@
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
- int result;
857
+ int rc;
858858
if( !zScript ) return TH_OK;
859859
Th_FossilInit(TH_INIT_DEFAULT);
860860
if( zUuid ){
861
- result = Th_SetVar(g.interp, "uuid", -1, zUuid, -1);
862
- if( result!=TH_OK ){
861
+ rc = Th_SetVar(g.interp, "uuid", -1, zUuid, -1);
862
+ if( rc!=TH_OK ){
863863
fossil_error(1, "%s", Th_GetResult(g.interp, 0));
864
- return result;
864
+ return rc;
865865
}
866866
}
867
- result = Th_Eval(g.interp, 0, zScript, -1);
868
- if( result!=TH_OK ){
867
+ rc = Th_Eval(g.interp, 0, zScript, -1);
868
+ if( rc!=TH_OK ){
869869
fossil_error(1, "%s", Th_GetResult(g.interp, 0));
870870
}
871
- return result;
871
+ return rc;
872872
}
873873
874874
/*
875875
** Runs the pre-transfer TH1 script, if any, and returns its return code.
876876
** This script may be run multiple times. If the script performs actions
@@ -914,11 +914,11 @@
914914
int isClone = 0;
915915
int nGimme = 0;
916916
int size;
917917
int recvConfig = 0;
918918
char *zNow;
919
- int result;
919
+ int rc;
920920
921921
if( fossil_strcmp(PD("REQUEST_METHOD","POST"),"POST") ){
922922
fossil_redirect_home();
923923
}
924924
g.zLogin = "anonymous";
@@ -944,12 +944,12 @@
944944
db_begin_transaction();
945945
db_multi_exec(
946946
"CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
947947
);
948948
manifest_crosslink_begin();
949
- result = xfer_run_common_script();
950
- if( result==TH_ERROR ){
949
+ rc = xfer_run_common_script();
950
+ if( rc==TH_ERROR ){
951951
cgi_reset_content();
952952
@ error common\sscript\sfailed:\s%F(g.zErrMsg)
953953
nErr++;
954954
}
955955
while( blob_line(xfer.pIn, &xfer.line) ){
@@ -1272,13 +1272,13 @@
12721272
}
12731273
blobarray_reset(xfer.aToken, xfer.nToken);
12741274
blob_reset(&xfer.line);
12751275
}
12761276
if( isPush ){
1277
- if( result==TH_OK ){
1278
- result = xfer_run_script(xfer_push_code(), 0);
1279
- if( result==TH_ERROR ){
1277
+ if( rc==TH_OK ){
1278
+ rc = xfer_run_script(xfer_push_code(), 0);
1279
+ if( rc==TH_ERROR ){
12801280
cgi_reset_content();
12811281
@ error push\sscript\sfailed:\s%F(g.zErrMsg)
12821282
nErr++;
12831283
}
12841284
}
@@ -1301,11 +1301,11 @@
13011301
}
13021302
if( recvConfig ){
13031303
configure_finalize_receive();
13041304
}
13051305
db_multi_exec("DROP TABLE onremote");
1306
- manifest_crosslink_end();
1306
+ manifest_crosslink_end(MC_PERMIT_HOOKS);
13071307
13081308
/* Send the server timestamp last, in case prior processing happened
13091309
** to use up a significant fraction of our time window.
13101310
*/
13111311
zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')");
@@ -1928,10 +1928,10 @@
19281928
"%s finished with %lld bytes sent, %lld bytes received\n",
19291929
zOpType, nSent, nRcvd);
19301930
transport_close(GLOBAL_URL());
19311931
transport_global_shutdown(GLOBAL_URL());
19321932
db_multi_exec("DROP TABLE onremote");
1933
- manifest_crosslink_end();
1933
+ manifest_crosslink_end(MC_PERMIT_HOOKS);
19341934
content_enable_dephantomize(1);
19351935
db_end_transaction(0);
19361936
return nErr;
19371937
}
19381938
--- src/xfer.c
+++ src/xfer.c
@@ -852,25 +852,25 @@
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;
865 }
866 }
867 result = Th_Eval(g.interp, 0, zScript, -1);
868 if( result!=TH_OK ){
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 ** This script may be run multiple times. If the script performs actions
@@ -914,11 +914,11 @@
914 int isClone = 0;
915 int nGimme = 0;
916 int size;
917 int recvConfig = 0;
918 char *zNow;
919 int result;
920
921 if( fossil_strcmp(PD("REQUEST_METHOD","POST"),"POST") ){
922 fossil_redirect_home();
923 }
924 g.zLogin = "anonymous";
@@ -944,12 +944,12 @@
944 db_begin_transaction();
945 db_multi_exec(
946 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
947 );
948 manifest_crosslink_begin();
949 result = xfer_run_common_script();
950 if( result==TH_ERROR ){
951 cgi_reset_content();
952 @ error common\sscript\sfailed:\s%F(g.zErrMsg)
953 nErr++;
954 }
955 while( blob_line(xfer.pIn, &xfer.line) ){
@@ -1272,13 +1272,13 @@
1272 }
1273 blobarray_reset(xfer.aToken, xfer.nToken);
1274 blob_reset(&xfer.line);
1275 }
1276 if( isPush ){
1277 if( result==TH_OK ){
1278 result = xfer_run_script(xfer_push_code(), 0);
1279 if( result==TH_ERROR ){
1280 cgi_reset_content();
1281 @ error push\sscript\sfailed:\s%F(g.zErrMsg)
1282 nErr++;
1283 }
1284 }
@@ -1301,11 +1301,11 @@
1301 }
1302 if( recvConfig ){
1303 configure_finalize_receive();
1304 }
1305 db_multi_exec("DROP TABLE onremote");
1306 manifest_crosslink_end();
1307
1308 /* Send the server timestamp last, in case prior processing happened
1309 ** to use up a significant fraction of our time window.
1310 */
1311 zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')");
@@ -1928,10 +1928,10 @@
1928 "%s finished with %lld bytes sent, %lld bytes received\n",
1929 zOpType, nSent, nRcvd);
1930 transport_close(GLOBAL_URL());
1931 transport_global_shutdown(GLOBAL_URL());
1932 db_multi_exec("DROP TABLE onremote");
1933 manifest_crosslink_end();
1934 content_enable_dephantomize(1);
1935 db_end_transaction(0);
1936 return nErr;
1937 }
1938
--- src/xfer.c
+++ src/xfer.c
@@ -852,25 +852,25 @@
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 rc;
858 if( !zScript ) return TH_OK;
859 Th_FossilInit(TH_INIT_DEFAULT);
860 if( zUuid ){
861 rc = Th_SetVar(g.interp, "uuid", -1, zUuid, -1);
862 if( rc!=TH_OK ){
863 fossil_error(1, "%s", Th_GetResult(g.interp, 0));
864 return rc;
865 }
866 }
867 rc = Th_Eval(g.interp, 0, zScript, -1);
868 if( rc!=TH_OK ){
869 fossil_error(1, "%s", Th_GetResult(g.interp, 0));
870 }
871 return rc;
872 }
873
874 /*
875 ** Runs the pre-transfer TH1 script, if any, and returns its return code.
876 ** This script may be run multiple times. If the script performs actions
@@ -914,11 +914,11 @@
914 int isClone = 0;
915 int nGimme = 0;
916 int size;
917 int recvConfig = 0;
918 char *zNow;
919 int rc;
920
921 if( fossil_strcmp(PD("REQUEST_METHOD","POST"),"POST") ){
922 fossil_redirect_home();
923 }
924 g.zLogin = "anonymous";
@@ -944,12 +944,12 @@
944 db_begin_transaction();
945 db_multi_exec(
946 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
947 );
948 manifest_crosslink_begin();
949 rc = xfer_run_common_script();
950 if( rc==TH_ERROR ){
951 cgi_reset_content();
952 @ error common\sscript\sfailed:\s%F(g.zErrMsg)
953 nErr++;
954 }
955 while( blob_line(xfer.pIn, &xfer.line) ){
@@ -1272,13 +1272,13 @@
1272 }
1273 blobarray_reset(xfer.aToken, xfer.nToken);
1274 blob_reset(&xfer.line);
1275 }
1276 if( isPush ){
1277 if( rc==TH_OK ){
1278 rc = xfer_run_script(xfer_push_code(), 0);
1279 if( rc==TH_ERROR ){
1280 cgi_reset_content();
1281 @ error push\sscript\sfailed:\s%F(g.zErrMsg)
1282 nErr++;
1283 }
1284 }
@@ -1301,11 +1301,11 @@
1301 }
1302 if( recvConfig ){
1303 configure_finalize_receive();
1304 }
1305 db_multi_exec("DROP TABLE onremote");
1306 manifest_crosslink_end(MC_PERMIT_HOOKS);
1307
1308 /* Send the server timestamp last, in case prior processing happened
1309 ** to use up a significant fraction of our time window.
1310 */
1311 zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')");
@@ -1928,10 +1928,10 @@
1928 "%s finished with %lld bytes sent, %lld bytes received\n",
1929 zOpType, nSent, nRcvd);
1930 transport_close(GLOBAL_URL());
1931 transport_global_shutdown(GLOBAL_URL());
1932 db_multi_exec("DROP TABLE onremote");
1933 manifest_crosslink_end(MC_PERMIT_HOOKS);
1934 content_enable_dephantomize(1);
1935 db_end_transaction(0);
1936 return nErr;
1937 }
1938

Keyboard Shortcuts

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