Fossil SCM

Some corrections to ticket hook logic.

mistachkin 2014-01-09 20:11 delay-ticket-hook
Commit a6faa2aee488d538566c4380ee14dacc1e7dd43c
1 file changed +8 -5
+8 -5
--- src/manifest.c
+++ src/manifest.c
@@ -1497,21 +1497,24 @@
14971497
** Finish up a sequence of manifest_crosslink calls.
14981498
*/
14991499
int manifest_crosslink_end(int flags){
15001500
Stmt q, u;
15011501
int i;
1502
- int rc = TH_ERROR;
1502
+ int rc = TH_OK;
1503
+ int permitHooks = (flags & MC_PERMIT_HOOKS);
1504
+ const char *zScript = 0;
15031505
assert( manifest_crosslink_busy==1 );
1504
- if( flags&MC_PERMIT_HOOKS ){
1506
+ zScript = xfer_ticket_code();
1507
+ if( zScript && permitHooks ){
15051508
rc = xfer_run_common_script();
15061509
}
15071510
db_prepare(&q, "SELECT uuid FROM pending_tkt");
15081511
while( db_step(&q)==SQLITE_ROW ){
15091512
const char *zUuid = db_column_text(&q, 0);
15101513
ticket_rebuild_entry(zUuid);
1511
- if( rc==TH_OK ){
1512
- rc = xfer_run_script(xfer_ticket_code(), zUuid);
1514
+ if( rc==TH_OK && zScript && permitHooks ){
1515
+ rc = xfer_run_script(zScript, zUuid);
15131516
}
15141517
}
15151518
db_finalize(&q);
15161519
db_multi_exec("DROP TABLE pending_tkt");
15171520
@@ -1543,11 +1546,11 @@
15431546
"DROP TABLE time_fudge;"
15441547
);
15451548
15461549
db_end_transaction(0);
15471550
manifest_crosslink_busy = 0;
1548
- return rc;
1551
+ return ( rc!=TH_ERROR );
15491552
}
15501553
15511554
/*
15521555
** Make an entry in the event table for a ticket change artifact.
15531556
*/
15541557
--- src/manifest.c
+++ src/manifest.c
@@ -1497,21 +1497,24 @@
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_ERROR;
 
 
1503 assert( manifest_crosslink_busy==1 );
1504 if( flags&MC_PERMIT_HOOKS ){
 
1505 rc = xfer_run_common_script();
1506 }
1507 db_prepare(&q, "SELECT uuid FROM pending_tkt");
1508 while( db_step(&q)==SQLITE_ROW ){
1509 const char *zUuid = db_column_text(&q, 0);
1510 ticket_rebuild_entry(zUuid);
1511 if( rc==TH_OK ){
1512 rc = xfer_run_script(xfer_ticket_code(), zUuid);
1513 }
1514 }
1515 db_finalize(&q);
1516 db_multi_exec("DROP TABLE pending_tkt");
1517
@@ -1543,11 +1546,11 @@
1543 "DROP TABLE time_fudge;"
1544 );
1545
1546 db_end_transaction(0);
1547 manifest_crosslink_busy = 0;
1548 return rc;
1549 }
1550
1551 /*
1552 ** Make an entry in the event table for a ticket change artifact.
1553 */
1554
--- src/manifest.c
+++ src/manifest.c
@@ -1497,21 +1497,24 @@
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 zScript = xfer_ticket_code();
1507 if( zScript && permitHooks ){
1508 rc = xfer_run_common_script();
1509 }
1510 db_prepare(&q, "SELECT uuid FROM pending_tkt");
1511 while( db_step(&q)==SQLITE_ROW ){
1512 const char *zUuid = db_column_text(&q, 0);
1513 ticket_rebuild_entry(zUuid);
1514 if( rc==TH_OK && zScript && permitHooks ){
1515 rc = xfer_run_script(zScript, zUuid);
1516 }
1517 }
1518 db_finalize(&q);
1519 db_multi_exec("DROP TABLE pending_tkt");
1520
@@ -1543,11 +1546,11 @@
1546 "DROP TABLE time_fudge;"
1547 );
1548
1549 db_end_transaction(0);
1550 manifest_crosslink_busy = 0;
1551 return ( rc!=TH_ERROR );
1552 }
1553
1554 /*
1555 ** Make an entry in the event table for a ticket change artifact.
1556 */
1557

Keyboard Shortcuts

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