Fossil SCM
Centralize and simplify the commit/ticket hook integration.
Commit
6cf28968dbfb948d67034b344a57979cbd6f8268
Parent
3db05280caba9cb…
15 files changed
+2
-2
+1
-2
+2
-4
+2
-2
+1
-1
+1
-1
+1
-2
+1
-2
+17
-6
+1
-1
+1
-2
+1
-1
+7
-9
+1
-1
+43
-29
+2
-2
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -214,11 +214,11 @@ | ||
| 214 | 214 | }else{ |
| 215 | 215 | rid = content_put(pAttach); |
| 216 | 216 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d);", rid); |
| 217 | 217 | db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid); |
| 218 | 218 | } |
| 219 | - manifest_crosslink(rid, pAttach); | |
| 219 | + manifest_crosslink(rid, pAttach, MC_NONE); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
| 223 | 223 | /* |
| 224 | 224 | ** WEBPAGE: attachadd |
| @@ -431,11 +431,11 @@ | ||
| 431 | 431 | blob_appendf(&manifest, "D %s\n", zDate); |
| 432 | 432 | blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody"); |
| 433 | 433 | md5sum_blob(&manifest, &cksum); |
| 434 | 434 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 435 | 435 | rid = content_put(&manifest); |
| 436 | - manifest_crosslink(rid, &manifest); | |
| 436 | + manifest_crosslink(rid, &manifest, MC_NONE); | |
| 437 | 437 | db_end_transaction(0); |
| 438 | 438 | @ <p>The attachment below has been deleted.</p> |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | if( P("del") |
| 442 | 442 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -214,11 +214,11 @@ | |
| 214 | }else{ |
| 215 | rid = content_put(pAttach); |
| 216 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d);", rid); |
| 217 | db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid); |
| 218 | } |
| 219 | manifest_crosslink(rid, pAttach); |
| 220 | } |
| 221 | |
| 222 | |
| 223 | /* |
| 224 | ** WEBPAGE: attachadd |
| @@ -431,11 +431,11 @@ | |
| 431 | blob_appendf(&manifest, "D %s\n", zDate); |
| 432 | blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody"); |
| 433 | md5sum_blob(&manifest, &cksum); |
| 434 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 435 | rid = content_put(&manifest); |
| 436 | manifest_crosslink(rid, &manifest); |
| 437 | db_end_transaction(0); |
| 438 | @ <p>The attachment below has been deleted.</p> |
| 439 | } |
| 440 | |
| 441 | if( P("del") |
| 442 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -214,11 +214,11 @@ | |
| 214 | }else{ |
| 215 | rid = content_put(pAttach); |
| 216 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d);", rid); |
| 217 | db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid); |
| 218 | } |
| 219 | manifest_crosslink(rid, pAttach, MC_NONE); |
| 220 | } |
| 221 | |
| 222 | |
| 223 | /* |
| 224 | ** WEBPAGE: attachadd |
| @@ -431,11 +431,11 @@ | |
| 431 | blob_appendf(&manifest, "D %s\n", zDate); |
| 432 | blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody"); |
| 433 | md5sum_blob(&manifest, &cksum); |
| 434 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 435 | rid = content_put(&manifest); |
| 436 | manifest_crosslink(rid, &manifest, MC_NONE); |
| 437 | db_end_transaction(0); |
| 438 | @ <p>The attachment below has been deleted.</p> |
| 439 | } |
| 440 | |
| 441 | if( P("del") |
| 442 |
+1
-2
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -153,12 +153,11 @@ | ||
| 153 | 153 | brid = content_put_ex(&branch, 0, 0, 0, isPrivate); |
| 154 | 154 | if( brid==0 ){ |
| 155 | 155 | fossil_fatal("trouble committing manifest: %s", g.zErrMsg); |
| 156 | 156 | } |
| 157 | 157 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid); |
| 158 | - xfer_run_common_script(); | |
| 159 | - if( manifest_crosslink(brid, &branch)==0 ){ | |
| 158 | + if( manifest_crosslink(brid, &branch, MC_PERMIT_HOOKS)==0 ){ | |
| 160 | 159 | fossil_fatal("%s\n", g.zErrMsg); |
| 161 | 160 | } |
| 162 | 161 | assert( blob_is_reset(&branch) ); |
| 163 | 162 | content_deltify(rootid, brid, 0); |
| 164 | 163 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid); |
| 165 | 164 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -153,12 +153,11 @@ | |
| 153 | brid = content_put_ex(&branch, 0, 0, 0, isPrivate); |
| 154 | if( brid==0 ){ |
| 155 | fossil_fatal("trouble committing manifest: %s", g.zErrMsg); |
| 156 | } |
| 157 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid); |
| 158 | xfer_run_common_script(); |
| 159 | if( manifest_crosslink(brid, &branch)==0 ){ |
| 160 | fossil_fatal("%s\n", g.zErrMsg); |
| 161 | } |
| 162 | assert( blob_is_reset(&branch) ); |
| 163 | content_deltify(rootid, brid, 0); |
| 164 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid); |
| 165 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -153,12 +153,11 @@ | |
| 153 | brid = content_put_ex(&branch, 0, 0, 0, isPrivate); |
| 154 | if( brid==0 ){ |
| 155 | fossil_fatal("trouble committing manifest: %s", g.zErrMsg); |
| 156 | } |
| 157 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid); |
| 158 | if( manifest_crosslink(brid, &branch, MC_PERMIT_HOOKS)==0 ){ |
| 159 | fossil_fatal("%s\n", g.zErrMsg); |
| 160 | } |
| 161 | assert( blob_is_reset(&branch) ); |
| 162 | content_deltify(rootid, brid, 0); |
| 163 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid); |
| 164 |
+2
-4
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1806,14 +1806,12 @@ | ||
| 1806 | 1806 | nvid = content_put(&manifest); |
| 1807 | 1807 | if( nvid==0 ){ |
| 1808 | 1808 | fossil_fatal("trouble committing manifest: %s", g.zErrMsg); |
| 1809 | 1809 | } |
| 1810 | 1810 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid); |
| 1811 | - if( !dryRunFlag ){ | |
| 1812 | - xfer_run_common_script(); | |
| 1813 | - } | |
| 1814 | - if( manifest_crosslink(nvid, &manifest)==0 ){ | |
| 1811 | + if( manifest_crosslink(nvid, &manifest, | |
| 1812 | + dryRunFlag ? MC_NONE : MC_PERMIT_HOOKS)==0 ){ | |
| 1815 | 1813 | fossil_fatal("%s\n", g.zErrMsg); |
| 1816 | 1814 | } |
| 1817 | 1815 | assert( blob_is_reset(&manifest) ); |
| 1818 | 1816 | content_deltify(vid, nvid, 0); |
| 1819 | 1817 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); |
| 1820 | 1818 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1806,14 +1806,12 @@ | |
| 1806 | nvid = content_put(&manifest); |
| 1807 | if( nvid==0 ){ |
| 1808 | fossil_fatal("trouble committing manifest: %s", g.zErrMsg); |
| 1809 | } |
| 1810 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid); |
| 1811 | if( !dryRunFlag ){ |
| 1812 | xfer_run_common_script(); |
| 1813 | } |
| 1814 | if( manifest_crosslink(nvid, &manifest)==0 ){ |
| 1815 | fossil_fatal("%s\n", g.zErrMsg); |
| 1816 | } |
| 1817 | assert( blob_is_reset(&manifest) ); |
| 1818 | content_deltify(vid, nvid, 0); |
| 1819 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); |
| 1820 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1806,14 +1806,12 @@ | |
| 1806 | nvid = content_put(&manifest); |
| 1807 | if( nvid==0 ){ |
| 1808 | fossil_fatal("trouble committing manifest: %s", g.zErrMsg); |
| 1809 | } |
| 1810 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid); |
| 1811 | if( manifest_crosslink(nvid, &manifest, |
| 1812 | dryRunFlag ? MC_NONE : MC_PERMIT_HOOKS)==0 ){ |
| 1813 | fossil_fatal("%s\n", g.zErrMsg); |
| 1814 | } |
| 1815 | assert( blob_is_reset(&manifest) ); |
| 1816 | content_deltify(vid, nvid, 0); |
| 1817 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); |
| 1818 |
+2
-2
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -388,11 +388,11 @@ | ||
| 388 | 388 | int i; |
| 389 | 389 | |
| 390 | 390 | /* Parse the object rid itself */ |
| 391 | 391 | if( linkFlag ){ |
| 392 | 392 | content_get(rid, &content); |
| 393 | - manifest_crosslink(rid, &content); | |
| 393 | + manifest_crosslink(rid, &content, MC_NONE); | |
| 394 | 394 | assert( blob_is_reset(&content) ); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /* Parse all delta-manifests that depend on baseline-manifest rid */ |
| 398 | 398 | db_prepare(&q, "SELECT rid FROM orphan WHERE baseline=%d", rid); |
| @@ -405,11 +405,11 @@ | ||
| 405 | 405 | aChild[nChildUsed++] = child; |
| 406 | 406 | } |
| 407 | 407 | db_finalize(&q); |
| 408 | 408 | for(i=0; i<nChildUsed; i++){ |
| 409 | 409 | content_get(aChild[i], &content); |
| 410 | - manifest_crosslink(aChild[i], &content); | |
| 410 | + manifest_crosslink(aChild[i], &content, MC_NONE); | |
| 411 | 411 | assert( blob_is_reset(&content) ); |
| 412 | 412 | } |
| 413 | 413 | if( nChildUsed ){ |
| 414 | 414 | db_multi_exec("DELETE FROM orphan WHERE baseline=%d", rid); |
| 415 | 415 | } |
| 416 | 416 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -388,11 +388,11 @@ | |
| 388 | int i; |
| 389 | |
| 390 | /* Parse the object rid itself */ |
| 391 | if( linkFlag ){ |
| 392 | content_get(rid, &content); |
| 393 | manifest_crosslink(rid, &content); |
| 394 | assert( blob_is_reset(&content) ); |
| 395 | } |
| 396 | |
| 397 | /* Parse all delta-manifests that depend on baseline-manifest rid */ |
| 398 | db_prepare(&q, "SELECT rid FROM orphan WHERE baseline=%d", rid); |
| @@ -405,11 +405,11 @@ | |
| 405 | aChild[nChildUsed++] = child; |
| 406 | } |
| 407 | db_finalize(&q); |
| 408 | for(i=0; i<nChildUsed; i++){ |
| 409 | content_get(aChild[i], &content); |
| 410 | manifest_crosslink(aChild[i], &content); |
| 411 | assert( blob_is_reset(&content) ); |
| 412 | } |
| 413 | if( nChildUsed ){ |
| 414 | db_multi_exec("DELETE FROM orphan WHERE baseline=%d", rid); |
| 415 | } |
| 416 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -388,11 +388,11 @@ | |
| 388 | int i; |
| 389 | |
| 390 | /* Parse the object rid itself */ |
| 391 | if( linkFlag ){ |
| 392 | content_get(rid, &content); |
| 393 | manifest_crosslink(rid, &content, MC_NONE); |
| 394 | assert( blob_is_reset(&content) ); |
| 395 | } |
| 396 | |
| 397 | /* Parse all delta-manifests that depend on baseline-manifest rid */ |
| 398 | db_prepare(&q, "SELECT rid FROM orphan WHERE baseline=%d", rid); |
| @@ -405,11 +405,11 @@ | |
| 405 | aChild[nChildUsed++] = child; |
| 406 | } |
| 407 | db_finalize(&q); |
| 408 | for(i=0; i<nChildUsed; i++){ |
| 409 | content_get(aChild[i], &content); |
| 410 | manifest_crosslink(aChild[i], &content, MC_NONE); |
| 411 | assert( blob_is_reset(&content) ); |
| 412 | } |
| 413 | if( nChildUsed ){ |
| 414 | db_multi_exec("DELETE FROM orphan WHERE baseline=%d", rid); |
| 415 | } |
| 416 |
M
src/db.c
+1
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1412,11 +1412,11 @@ | ||
| 1412 | 1412 | blob_appendf(&manifest, "U %F\n", g.zLogin); |
| 1413 | 1413 | md5sum_blob(&manifest, &hash); |
| 1414 | 1414 | blob_appendf(&manifest, "Z %b\n", &hash); |
| 1415 | 1415 | blob_reset(&hash); |
| 1416 | 1416 | rid = content_put(&manifest); |
| 1417 | - manifest_crosslink(rid, &manifest); | |
| 1417 | + manifest_crosslink(rid, &manifest, MC_NONE); | |
| 1418 | 1418 | } |
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | 1421 | /* |
| 1422 | 1422 | ** COMMAND: new* |
| 1423 | 1423 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1412,11 +1412,11 @@ | |
| 1412 | blob_appendf(&manifest, "U %F\n", g.zLogin); |
| 1413 | md5sum_blob(&manifest, &hash); |
| 1414 | blob_appendf(&manifest, "Z %b\n", &hash); |
| 1415 | blob_reset(&hash); |
| 1416 | rid = content_put(&manifest); |
| 1417 | manifest_crosslink(rid, &manifest); |
| 1418 | } |
| 1419 | } |
| 1420 | |
| 1421 | /* |
| 1422 | ** COMMAND: new* |
| 1423 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1412,11 +1412,11 @@ | |
| 1412 | blob_appendf(&manifest, "U %F\n", g.zLogin); |
| 1413 | md5sum_blob(&manifest, &hash); |
| 1414 | blob_appendf(&manifest, "Z %b\n", &hash); |
| 1415 | blob_reset(&hash); |
| 1416 | rid = content_put(&manifest); |
| 1417 | manifest_crosslink(rid, &manifest, MC_NONE); |
| 1418 | } |
| 1419 | } |
| 1420 | |
| 1421 | /* |
| 1422 | ** COMMAND: new* |
| 1423 |
+1
-1
| --- src/event.c | ||
| +++ src/event.c | ||
| @@ -351,11 +351,11 @@ | ||
| 351 | 351 | md5sum_blob(&event, &cksum); |
| 352 | 352 | blob_appendf(&event, "Z %b\n", &cksum); |
| 353 | 353 | blob_reset(&cksum); |
| 354 | 354 | nrid = content_put(&event); |
| 355 | 355 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 356 | - manifest_crosslink(nrid, &event); | |
| 356 | + manifest_crosslink(nrid, &event, MC_NONE); | |
| 357 | 357 | assert( blob_is_reset(&event) ); |
| 358 | 358 | content_deltify(rid, nrid, 0); |
| 359 | 359 | db_end_transaction(0); |
| 360 | 360 | cgi_redirectf("event?name=%T", zEventId); |
| 361 | 361 | } |
| 362 | 362 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -351,11 +351,11 @@ | |
| 351 | md5sum_blob(&event, &cksum); |
| 352 | blob_appendf(&event, "Z %b\n", &cksum); |
| 353 | blob_reset(&cksum); |
| 354 | nrid = content_put(&event); |
| 355 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 356 | manifest_crosslink(nrid, &event); |
| 357 | assert( blob_is_reset(&event) ); |
| 358 | content_deltify(rid, nrid, 0); |
| 359 | db_end_transaction(0); |
| 360 | cgi_redirectf("event?name=%T", zEventId); |
| 361 | } |
| 362 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -351,11 +351,11 @@ | |
| 351 | md5sum_blob(&event, &cksum); |
| 352 | blob_appendf(&event, "Z %b\n", &cksum); |
| 353 | blob_reset(&cksum); |
| 354 | nrid = content_put(&event); |
| 355 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 356 | manifest_crosslink(nrid, &event, MC_NONE); |
| 357 | assert( blob_is_reset(&event) ); |
| 358 | content_deltify(rid, nrid, 0); |
| 359 | db_end_transaction(0); |
| 360 | cgi_redirectf("event?name=%T", zEventId); |
| 361 | } |
| 362 |
+1
-2
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2178,12 +2178,11 @@ | ||
| 2178 | 2178 | md5sum_blob(&ctrl, &cksum); |
| 2179 | 2179 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2180 | 2180 | db_begin_transaction(); |
| 2181 | 2181 | g.markPrivate = content_is_private(rid); |
| 2182 | 2182 | nrid = content_put(&ctrl); |
| 2183 | - xfer_run_common_script(); | |
| 2184 | - manifest_crosslink(nrid, &ctrl); | |
| 2183 | + manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); | |
| 2185 | 2184 | assert( blob_is_reset(&ctrl) ); |
| 2186 | 2185 | db_end_transaction(0); |
| 2187 | 2186 | } |
| 2188 | 2187 | cgi_redirectf("ci?name=%s", zUuid); |
| 2189 | 2188 | } |
| 2190 | 2189 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2178,12 +2178,11 @@ | |
| 2178 | md5sum_blob(&ctrl, &cksum); |
| 2179 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2180 | db_begin_transaction(); |
| 2181 | g.markPrivate = content_is_private(rid); |
| 2182 | nrid = content_put(&ctrl); |
| 2183 | xfer_run_common_script(); |
| 2184 | manifest_crosslink(nrid, &ctrl); |
| 2185 | assert( blob_is_reset(&ctrl) ); |
| 2186 | db_end_transaction(0); |
| 2187 | } |
| 2188 | cgi_redirectf("ci?name=%s", zUuid); |
| 2189 | } |
| 2190 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2178,12 +2178,11 @@ | |
| 2178 | md5sum_blob(&ctrl, &cksum); |
| 2179 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2180 | db_begin_transaction(); |
| 2181 | g.markPrivate = content_is_private(rid); |
| 2182 | nrid = content_put(&ctrl); |
| 2183 | manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); |
| 2184 | assert( blob_is_reset(&ctrl) ); |
| 2185 | db_end_transaction(0); |
| 2186 | } |
| 2187 | cgi_redirectf("ci?name=%s", zUuid); |
| 2188 | } |
| 2189 |
+1
-2
| --- src/json_branch.c | ||
| +++ src/json_branch.c | ||
| @@ -291,12 +291,11 @@ | ||
| 291 | 291 | brid = content_put(&branch); |
| 292 | 292 | if( brid==0 ){ |
| 293 | 293 | fossil_fatal("Problem committing manifest: %s", g.zErrMsg); |
| 294 | 294 | } |
| 295 | 295 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid); |
| 296 | - xfer_run_common_script(); | |
| 297 | - if( manifest_crosslink(brid, &branch)==0 ){ | |
| 296 | + if( manifest_crosslink(brid, &branch, MC_PERMIT_HOOKS)==0 ){ | |
| 298 | 297 | fossil_fatal("%s\n", g.zErrMsg); |
| 299 | 298 | } |
| 300 | 299 | assert( blob_is_reset(&branch) ); |
| 301 | 300 | content_deltify(rootid, brid, 0); |
| 302 | 301 | if( zNewRid ){ |
| 303 | 302 |
| --- src/json_branch.c | |
| +++ src/json_branch.c | |
| @@ -291,12 +291,11 @@ | |
| 291 | brid = content_put(&branch); |
| 292 | if( brid==0 ){ |
| 293 | fossil_fatal("Problem committing manifest: %s", g.zErrMsg); |
| 294 | } |
| 295 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid); |
| 296 | xfer_run_common_script(); |
| 297 | if( manifest_crosslink(brid, &branch)==0 ){ |
| 298 | fossil_fatal("%s\n", g.zErrMsg); |
| 299 | } |
| 300 | assert( blob_is_reset(&branch) ); |
| 301 | content_deltify(rootid, brid, 0); |
| 302 | if( zNewRid ){ |
| 303 |
| --- src/json_branch.c | |
| +++ src/json_branch.c | |
| @@ -291,12 +291,11 @@ | |
| 291 | brid = content_put(&branch); |
| 292 | if( brid==0 ){ |
| 293 | fossil_fatal("Problem committing manifest: %s", g.zErrMsg); |
| 294 | } |
| 295 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid); |
| 296 | if( manifest_crosslink(brid, &branch, MC_PERMIT_HOOKS)==0 ){ |
| 297 | fossil_fatal("%s\n", g.zErrMsg); |
| 298 | } |
| 299 | assert( blob_is_reset(&branch) ); |
| 300 | content_deltify(rootid, brid, 0); |
| 301 | if( zNewRid ){ |
| 302 |
+17
-6
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -42,10 +42,16 @@ | ||
| 42 | 42 | */ |
| 43 | 43 | #define PERM_REG 0 /* regular file */ |
| 44 | 44 | #define PERM_EXE 1 /* executable */ |
| 45 | 45 | #define PERM_LNK 2 /* symlink */ |
| 46 | 46 | |
| 47 | +/* | |
| 48 | +** Flags for use with manifest_crosslink(). | |
| 49 | +*/ | |
| 50 | +#define MC_NONE 0 /* default handling */ | |
| 51 | +#define MC_PERMIT_HOOKS 1 /* permit hooks to execute */ | |
| 52 | + | |
| 47 | 53 | /* |
| 48 | 54 | ** A single F-card within a manifest |
| 49 | 55 | */ |
| 50 | 56 | struct ManifestFile { |
| 51 | 57 | char *zName; /* Name of a file */ |
| @@ -1650,12 +1656,12 @@ | ||
| 1650 | 1656 | ** Historical note: This routine original processed manifests only. |
| 1651 | 1657 | ** Processing for other control artifacts was added later. The name |
| 1652 | 1658 | ** of the routine, "manifest_crosslink", and the name of this source |
| 1653 | 1659 | ** file, is a legacy of its original use. |
| 1654 | 1660 | */ |
| 1655 | -int manifest_crosslink(int rid, Blob *pContent){ | |
| 1656 | - int i, result; | |
| 1661 | +int manifest_crosslink(int rid, Blob *pContent, int flags){ | |
| 1662 | + int i, result = 1; | |
| 1657 | 1663 | Manifest *p; |
| 1658 | 1664 | Stmt q; |
| 1659 | 1665 | int parentid = 0; |
| 1660 | 1666 | const char *zScript = 0; |
| 1661 | 1667 | const char *zUuid = 0; |
| @@ -1679,11 +1685,11 @@ | ||
| 1679 | 1685 | fossil_error(1, "cannot fetch baseline manifest"); |
| 1680 | 1686 | return 0; |
| 1681 | 1687 | } |
| 1682 | 1688 | db_begin_transaction(); |
| 1683 | 1689 | if( p->type==CFTYPE_MANIFEST ){ |
| 1684 | - zScript = "xfer-commit-script"; | |
| 1690 | + zScript = xfer_commit_code(); | |
| 1685 | 1691 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1686 | 1692 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ |
| 1687 | 1693 | char *zCom; |
| 1688 | 1694 | for(i=0; i<p->nParent; i++){ |
| 1689 | 1695 | int pid = uuid_to_rid(p->azParent[i], 1); |
| @@ -1877,11 +1883,11 @@ | ||
| 1877 | 1883 | } |
| 1878 | 1884 | } |
| 1879 | 1885 | if( p->type==CFTYPE_TICKET ){ |
| 1880 | 1886 | char *zTag; |
| 1881 | 1887 | |
| 1882 | - zScript = "xfer-ticket-script"; | |
| 1888 | + zScript = xfer_ticket_code(); | |
| 1883 | 1889 | zUuid = p->zTicketUuid; |
| 1884 | 1890 | assert( manifest_crosslink_busy==1 ); |
| 1885 | 1891 | zTag = mprintf("tkt-%s", p->zTicketUuid); |
| 1886 | 1892 | tag_insert(zTag, 1, 0, rid, p->rDate, rid); |
| 1887 | 1893 | free(zTag); |
| @@ -2030,11 +2036,16 @@ | ||
| 2030 | 2036 | p->rDate, rid, p->zUser, blob_str(&comment)+1 |
| 2031 | 2037 | ); |
| 2032 | 2038 | blob_reset(&comment); |
| 2033 | 2039 | } |
| 2034 | 2040 | db_end_transaction(0); |
| 2035 | - result = (xfer_run_script(zScript, zUuid)==TH_OK); | |
| 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 | + } | |
| 2036 | 2047 | if( p->type==CFTYPE_MANIFEST ){ |
| 2037 | 2048 | manifest_cache_insert(p); |
| 2038 | 2049 | }else{ |
| 2039 | 2050 | manifest_destroy(p); |
| 2040 | 2051 | } |
| @@ -2055,7 +2066,7 @@ | ||
| 2055 | 2066 | Blob content; |
| 2056 | 2067 | db_find_and_open_repository(0, 0); |
| 2057 | 2068 | if( g.argc!=3 ) usage("RECORDID"); |
| 2058 | 2069 | rid = name_to_rid(g.argv[2]); |
| 2059 | 2070 | content_get(rid, &content); |
| 2060 | - manifest_crosslink(rid, &content); | |
| 2071 | + manifest_crosslink(rid, &content, MC_NONE); | |
| 2061 | 2072 | } |
| 2062 | 2073 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -42,10 +42,16 @@ | |
| 42 | */ |
| 43 | #define PERM_REG 0 /* regular file */ |
| 44 | #define PERM_EXE 1 /* executable */ |
| 45 | #define PERM_LNK 2 /* symlink */ |
| 46 | |
| 47 | /* |
| 48 | ** A single F-card within a manifest |
| 49 | */ |
| 50 | struct ManifestFile { |
| 51 | char *zName; /* Name of a file */ |
| @@ -1650,12 +1656,12 @@ | |
| 1650 | ** Historical note: This routine original processed manifests only. |
| 1651 | ** Processing for other control artifacts was added later. The name |
| 1652 | ** of the routine, "manifest_crosslink", and the name of this source |
| 1653 | ** file, is a legacy of its original use. |
| 1654 | */ |
| 1655 | int manifest_crosslink(int rid, Blob *pContent){ |
| 1656 | int i, result; |
| 1657 | Manifest *p; |
| 1658 | Stmt q; |
| 1659 | int parentid = 0; |
| 1660 | const char *zScript = 0; |
| 1661 | const char *zUuid = 0; |
| @@ -1679,11 +1685,11 @@ | |
| 1679 | fossil_error(1, "cannot fetch baseline manifest"); |
| 1680 | return 0; |
| 1681 | } |
| 1682 | db_begin_transaction(); |
| 1683 | if( p->type==CFTYPE_MANIFEST ){ |
| 1684 | zScript = "xfer-commit-script"; |
| 1685 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1686 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ |
| 1687 | char *zCom; |
| 1688 | for(i=0; i<p->nParent; i++){ |
| 1689 | int pid = uuid_to_rid(p->azParent[i], 1); |
| @@ -1877,11 +1883,11 @@ | |
| 1877 | } |
| 1878 | } |
| 1879 | if( p->type==CFTYPE_TICKET ){ |
| 1880 | char *zTag; |
| 1881 | |
| 1882 | zScript = "xfer-ticket-script"; |
| 1883 | zUuid = p->zTicketUuid; |
| 1884 | assert( manifest_crosslink_busy==1 ); |
| 1885 | zTag = mprintf("tkt-%s", p->zTicketUuid); |
| 1886 | tag_insert(zTag, 1, 0, rid, p->rDate, rid); |
| 1887 | free(zTag); |
| @@ -2030,11 +2036,16 @@ | |
| 2030 | p->rDate, rid, p->zUser, blob_str(&comment)+1 |
| 2031 | ); |
| 2032 | blob_reset(&comment); |
| 2033 | } |
| 2034 | db_end_transaction(0); |
| 2035 | result = (xfer_run_script(zScript, zUuid)==TH_OK); |
| 2036 | if( p->type==CFTYPE_MANIFEST ){ |
| 2037 | manifest_cache_insert(p); |
| 2038 | }else{ |
| 2039 | manifest_destroy(p); |
| 2040 | } |
| @@ -2055,7 +2066,7 @@ | |
| 2055 | Blob content; |
| 2056 | db_find_and_open_repository(0, 0); |
| 2057 | if( g.argc!=3 ) usage("RECORDID"); |
| 2058 | rid = name_to_rid(g.argv[2]); |
| 2059 | content_get(rid, &content); |
| 2060 | manifest_crosslink(rid, &content); |
| 2061 | } |
| 2062 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -42,10 +42,16 @@ | |
| 42 | */ |
| 43 | #define PERM_REG 0 /* regular file */ |
| 44 | #define PERM_EXE 1 /* executable */ |
| 45 | #define PERM_LNK 2 /* symlink */ |
| 46 | |
| 47 | /* |
| 48 | ** Flags for use with manifest_crosslink(). |
| 49 | */ |
| 50 | #define MC_NONE 0 /* default handling */ |
| 51 | #define MC_PERMIT_HOOKS 1 /* permit hooks to execute */ |
| 52 | |
| 53 | /* |
| 54 | ** A single F-card within a manifest |
| 55 | */ |
| 56 | struct ManifestFile { |
| 57 | char *zName; /* Name of a file */ |
| @@ -1650,12 +1656,12 @@ | |
| 1656 | ** Historical note: This routine original processed manifests only. |
| 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 = 1; |
| 1663 | Manifest *p; |
| 1664 | Stmt q; |
| 1665 | int parentid = 0; |
| 1666 | const char *zScript = 0; |
| 1667 | const char *zUuid = 0; |
| @@ -1679,11 +1685,11 @@ | |
| 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); |
| @@ -1877,11 +1883,11 @@ | |
| 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); |
| @@ -2030,11 +2036,16 @@ | |
| 2036 | p->rDate, rid, p->zUser, blob_str(&comment)+1 |
| 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 | } |
| @@ -2055,7 +2066,7 @@ | |
| 2066 | Blob content; |
| 2067 | db_find_and_open_repository(0, 0); |
| 2068 | if( g.argc!=3 ) usage("RECORDID"); |
| 2069 | rid = name_to_rid(g.argv[2]); |
| 2070 | content_get(rid, &content); |
| 2071 | manifest_crosslink(rid, &content, MC_NONE); |
| 2072 | } |
| 2073 |
+1
-1
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -250,11 +250,11 @@ | ||
| 250 | 250 | blob_copy(©, pBase); |
| 251 | 251 | pUse = © |
| 252 | 252 | } |
| 253 | 253 | if( zFNameFormat==0 ){ |
| 254 | 254 | /* We are doing "fossil rebuild" */ |
| 255 | - manifest_crosslink(rid, pUse); | |
| 255 | + manifest_crosslink(rid, pUse, MC_NONE); | |
| 256 | 256 | }else{ |
| 257 | 257 | /* We are doing "fossil deconstruct" */ |
| 258 | 258 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 259 | 259 | char *zFile = mprintf(zFNameFormat, zUuid, zUuid+prefixLength); |
| 260 | 260 | blob_write_to_file(pUse,zFile); |
| 261 | 261 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -250,11 +250,11 @@ | |
| 250 | blob_copy(©, pBase); |
| 251 | pUse = © |
| 252 | } |
| 253 | if( zFNameFormat==0 ){ |
| 254 | /* We are doing "fossil rebuild" */ |
| 255 | manifest_crosslink(rid, pUse); |
| 256 | }else{ |
| 257 | /* We are doing "fossil deconstruct" */ |
| 258 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 259 | char *zFile = mprintf(zFNameFormat, zUuid, zUuid+prefixLength); |
| 260 | blob_write_to_file(pUse,zFile); |
| 261 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -250,11 +250,11 @@ | |
| 250 | blob_copy(©, pBase); |
| 251 | pUse = © |
| 252 | } |
| 253 | if( zFNameFormat==0 ){ |
| 254 | /* We are doing "fossil rebuild" */ |
| 255 | manifest_crosslink(rid, pUse, MC_NONE); |
| 256 | }else{ |
| 257 | /* We are doing "fossil deconstruct" */ |
| 258 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 259 | char *zFile = mprintf(zFNameFormat, zUuid, zUuid+prefixLength); |
| 260 | blob_write_to_file(pUse,zFile); |
| 261 |
+1
-2
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -326,12 +326,11 @@ | ||
| 326 | 326 | } |
| 327 | 327 | blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 328 | 328 | md5sum_blob(&ctrl, &cksum); |
| 329 | 329 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 330 | 330 | nrid = content_put(&ctrl); |
| 331 | - xfer_run_common_script(); | |
| 332 | - manifest_crosslink(nrid, &ctrl); | |
| 331 | + manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); | |
| 333 | 332 | assert( blob_is_reset(&ctrl) ); |
| 334 | 333 | } |
| 335 | 334 | |
| 336 | 335 | /* |
| 337 | 336 | ** COMMAND: tag |
| 338 | 337 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -326,12 +326,11 @@ | |
| 326 | } |
| 327 | blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 328 | md5sum_blob(&ctrl, &cksum); |
| 329 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 330 | nrid = content_put(&ctrl); |
| 331 | xfer_run_common_script(); |
| 332 | manifest_crosslink(nrid, &ctrl); |
| 333 | assert( blob_is_reset(&ctrl) ); |
| 334 | } |
| 335 | |
| 336 | /* |
| 337 | ** COMMAND: tag |
| 338 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -326,12 +326,11 @@ | |
| 326 | } |
| 327 | blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 328 | md5sum_blob(&ctrl, &cksum); |
| 329 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 330 | nrid = content_put(&ctrl); |
| 331 | manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); |
| 332 | assert( blob_is_reset(&ctrl) ); |
| 333 | } |
| 334 | |
| 335 | /* |
| 336 | ** COMMAND: tag |
| 337 |
+1
-1
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -849,11 +849,11 @@ | ||
| 849 | 849 | const char *zSep, *zType, *zRegexp, *zParams; |
| 850 | 850 | Blob hdr, payload; |
| 851 | 851 | ReCompiled *pRe = 0; |
| 852 | 852 | UrlData urlData; |
| 853 | 853 | |
| 854 | - if( argc<2 || argl[1]<6 || fossil_strnicmp(argv[1], "-asynchronous", argl[1]) ){ | |
| 854 | + if( argc<2 || fossil_strnicmp(argv[1], "-asynchronous", argl[1]) ){ | |
| 855 | 855 | Th_ErrorMessage(interp, |
| 856 | 856 | "synchronous http requests not yet implemented", 0, 0); |
| 857 | 857 | return TH_ERROR; |
| 858 | 858 | } |
| 859 | 859 | --argc; ++argv; ++argl; /* advance to next argument */ |
| 860 | 860 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -849,11 +849,11 @@ | |
| 849 | const char *zSep, *zType, *zRegexp, *zParams; |
| 850 | Blob hdr, payload; |
| 851 | ReCompiled *pRe = 0; |
| 852 | UrlData urlData; |
| 853 | |
| 854 | if( argc<2 || argl[1]<6 || fossil_strnicmp(argv[1], "-asynchronous", argl[1]) ){ |
| 855 | Th_ErrorMessage(interp, |
| 856 | "synchronous http requests not yet implemented", 0, 0); |
| 857 | return TH_ERROR; |
| 858 | } |
| 859 | --argc; ++argv; ++argl; /* advance to next argument */ |
| 860 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -849,11 +849,11 @@ | |
| 849 | const char *zSep, *zType, *zRegexp, *zParams; |
| 850 | Blob hdr, payload; |
| 851 | ReCompiled *pRe = 0; |
| 852 | UrlData urlData; |
| 853 | |
| 854 | if( argc<2 || fossil_strnicmp(argv[1], "-asynchronous", argl[1]) ){ |
| 855 | Th_ErrorMessage(interp, |
| 856 | "synchronous http requests not yet implemented", 0, 0); |
| 857 | return TH_ERROR; |
| 858 | } |
| 859 | --argc; ++argv; ++argl; /* advance to next argument */ |
| 860 |
+7
-9
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -534,12 +534,11 @@ | ||
| 534 | 534 | }else{ |
| 535 | 535 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d);", rid); |
| 536 | 536 | db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid); |
| 537 | 537 | } |
| 538 | 538 | manifest_crosslink_begin(); |
| 539 | - xfer_run_common_script(); | |
| 540 | - result = manifest_crosslink(rid, pTicket)==0; | |
| 539 | + result = (manifest_crosslink(rid, pTicket, MC_PERMIT_HOOKS)==0); | |
| 541 | 540 | assert( blob_is_reset(pTicket) ); |
| 542 | 541 | manifest_crosslink_end(); |
| 543 | 542 | return result; |
| 544 | 543 | } |
| 545 | 544 | |
| @@ -624,15 +623,16 @@ | ||
| 624 | 623 | @ <font color="blue"> |
| 625 | 624 | @ <p>Ticket artifact that would have been submitted:</p> |
| 626 | 625 | @ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote> |
| 627 | 626 | @ <hr /></font> |
| 628 | 627 | return TH_OK; |
| 629 | - }else if( g.thTrace ){ | |
| 630 | - Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n" | |
| 631 | - "}<br />\n", | |
| 632 | - blob_str(&tktchng)); | |
| 633 | 628 | }else{ |
| 629 | + if( g.thTrace ){ | |
| 630 | + Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n" | |
| 631 | + "}<br />\n", | |
| 632 | + blob_str(&tktchng)); | |
| 633 | + } | |
| 634 | 634 | ticket_put(&tktchng, zUuid, |
| 635 | 635 | (g.perm.ModTkt==0 && db_get_boolean("modreq-tkt",0)==1)); |
| 636 | 636 | } |
| 637 | 637 | return ticket_change(); |
| 638 | 638 | } |
| @@ -683,11 +683,10 @@ | ||
| 683 | 683 | } |
| 684 | 684 | captcha_generate(0); |
| 685 | 685 | @ </form> |
| 686 | 686 | if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1); |
| 687 | 687 | style_footer(); |
| 688 | - xfer_run_common_script(); | |
| 689 | 688 | } |
| 690 | 689 | |
| 691 | 690 | /* |
| 692 | 691 | ** WEBPAGE: tktedit |
| 693 | 692 | ** WEBPAGE: debug_tktedit |
| @@ -752,11 +751,10 @@ | ||
| 752 | 751 | } |
| 753 | 752 | captcha_generate(0); |
| 754 | 753 | @ </form> |
| 755 | 754 | if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT<br />\n", -1); |
| 756 | 755 | style_footer(); |
| 757 | - xfer_run_common_script(); | |
| 758 | 756 | } |
| 759 | 757 | |
| 760 | 758 | /* |
| 761 | 759 | ** Check the ticket table schema in zSchema to see if it appears to |
| 762 | 760 | ** be well-formed. If everything is OK, return NULL. If something is |
| @@ -1348,14 +1346,14 @@ | ||
| 1348 | 1346 | } |
| 1349 | 1347 | blob_appendf(&tktchng, "K %s\n", zTktUuid); |
| 1350 | 1348 | blob_appendf(&tktchng, "U %F\n", zUser); |
| 1351 | 1349 | md5sum_blob(&tktchng, &cksum); |
| 1352 | 1350 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 1353 | - if( xfer_run_common_script() || ticket_put(&tktchng, zTktUuid, 0) ){ | |
| 1351 | + if( ticket_put(&tktchng, zTktUuid, 0) ){ | |
| 1354 | 1352 | fossil_fatal("%s\n", g.zErrMsg); |
| 1355 | 1353 | }else{ |
| 1356 | 1354 | fossil_print("ticket %s succeeded for %s\n", |
| 1357 | 1355 | (eCmd==set?"set":"add"),zTktUuid); |
| 1358 | 1356 | } |
| 1359 | 1357 | } |
| 1360 | 1358 | } |
| 1361 | 1359 | } |
| 1362 | 1360 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -534,12 +534,11 @@ | |
| 534 | }else{ |
| 535 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d);", rid); |
| 536 | db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid); |
| 537 | } |
| 538 | manifest_crosslink_begin(); |
| 539 | xfer_run_common_script(); |
| 540 | result = manifest_crosslink(rid, pTicket)==0; |
| 541 | assert( blob_is_reset(pTicket) ); |
| 542 | manifest_crosslink_end(); |
| 543 | return result; |
| 544 | } |
| 545 | |
| @@ -624,15 +623,16 @@ | |
| 624 | @ <font color="blue"> |
| 625 | @ <p>Ticket artifact that would have been submitted:</p> |
| 626 | @ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote> |
| 627 | @ <hr /></font> |
| 628 | return TH_OK; |
| 629 | }else if( g.thTrace ){ |
| 630 | Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n" |
| 631 | "}<br />\n", |
| 632 | blob_str(&tktchng)); |
| 633 | }else{ |
| 634 | ticket_put(&tktchng, zUuid, |
| 635 | (g.perm.ModTkt==0 && db_get_boolean("modreq-tkt",0)==1)); |
| 636 | } |
| 637 | return ticket_change(); |
| 638 | } |
| @@ -683,11 +683,10 @@ | |
| 683 | } |
| 684 | captcha_generate(0); |
| 685 | @ </form> |
| 686 | if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1); |
| 687 | style_footer(); |
| 688 | xfer_run_common_script(); |
| 689 | } |
| 690 | |
| 691 | /* |
| 692 | ** WEBPAGE: tktedit |
| 693 | ** WEBPAGE: debug_tktedit |
| @@ -752,11 +751,10 @@ | |
| 752 | } |
| 753 | captcha_generate(0); |
| 754 | @ </form> |
| 755 | if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT<br />\n", -1); |
| 756 | style_footer(); |
| 757 | xfer_run_common_script(); |
| 758 | } |
| 759 | |
| 760 | /* |
| 761 | ** Check the ticket table schema in zSchema to see if it appears to |
| 762 | ** be well-formed. If everything is OK, return NULL. If something is |
| @@ -1348,14 +1346,14 @@ | |
| 1348 | } |
| 1349 | blob_appendf(&tktchng, "K %s\n", zTktUuid); |
| 1350 | blob_appendf(&tktchng, "U %F\n", zUser); |
| 1351 | md5sum_blob(&tktchng, &cksum); |
| 1352 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 1353 | if( xfer_run_common_script() || ticket_put(&tktchng, zTktUuid, 0) ){ |
| 1354 | fossil_fatal("%s\n", g.zErrMsg); |
| 1355 | }else{ |
| 1356 | fossil_print("ticket %s succeeded for %s\n", |
| 1357 | (eCmd==set?"set":"add"),zTktUuid); |
| 1358 | } |
| 1359 | } |
| 1360 | } |
| 1361 | } |
| 1362 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -534,12 +534,11 @@ | |
| 534 | }else{ |
| 535 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d);", rid); |
| 536 | db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", rid); |
| 537 | } |
| 538 | manifest_crosslink_begin(); |
| 539 | result = (manifest_crosslink(rid, pTicket, MC_PERMIT_HOOKS)==0); |
| 540 | assert( blob_is_reset(pTicket) ); |
| 541 | manifest_crosslink_end(); |
| 542 | return result; |
| 543 | } |
| 544 | |
| @@ -624,15 +623,16 @@ | |
| 623 | @ <font color="blue"> |
| 624 | @ <p>Ticket artifact that would have been submitted:</p> |
| 625 | @ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote> |
| 626 | @ <hr /></font> |
| 627 | return TH_OK; |
| 628 | }else{ |
| 629 | if( g.thTrace ){ |
| 630 | Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n" |
| 631 | "}<br />\n", |
| 632 | blob_str(&tktchng)); |
| 633 | } |
| 634 | ticket_put(&tktchng, zUuid, |
| 635 | (g.perm.ModTkt==0 && db_get_boolean("modreq-tkt",0)==1)); |
| 636 | } |
| 637 | return ticket_change(); |
| 638 | } |
| @@ -683,11 +683,10 @@ | |
| 683 | } |
| 684 | captcha_generate(0); |
| 685 | @ </form> |
| 686 | if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1); |
| 687 | style_footer(); |
| 688 | } |
| 689 | |
| 690 | /* |
| 691 | ** WEBPAGE: tktedit |
| 692 | ** WEBPAGE: debug_tktedit |
| @@ -752,11 +751,10 @@ | |
| 751 | } |
| 752 | captcha_generate(0); |
| 753 | @ </form> |
| 754 | if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT<br />\n", -1); |
| 755 | style_footer(); |
| 756 | } |
| 757 | |
| 758 | /* |
| 759 | ** Check the ticket table schema in zSchema to see if it appears to |
| 760 | ** be well-formed. If everything is OK, return NULL. If something is |
| @@ -1348,14 +1346,14 @@ | |
| 1346 | } |
| 1347 | blob_appendf(&tktchng, "K %s\n", zTktUuid); |
| 1348 | blob_appendf(&tktchng, "U %F\n", zUser); |
| 1349 | md5sum_blob(&tktchng, &cksum); |
| 1350 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 1351 | if( ticket_put(&tktchng, zTktUuid, 0) ){ |
| 1352 | fossil_fatal("%s\n", g.zErrMsg); |
| 1353 | }else{ |
| 1354 | fossil_print("ticket %s succeeded for %s\n", |
| 1355 | (eCmd==set?"set":"add"),zTktUuid); |
| 1356 | } |
| 1357 | } |
| 1358 | } |
| 1359 | } |
| 1360 |
+1
-1
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -294,11 +294,11 @@ | ||
| 294 | 294 | moderation_table_create(); |
| 295 | 295 | db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)", nrid); |
| 296 | 296 | } |
| 297 | 297 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 298 | 298 | db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", nrid); |
| 299 | - manifest_crosslink(nrid, pWiki); | |
| 299 | + manifest_crosslink(nrid, pWiki, MC_NONE); | |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /* |
| 303 | 303 | ** Formal names and common names for the various wiki styles. |
| 304 | 304 | */ |
| 305 | 305 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -294,11 +294,11 @@ | |
| 294 | moderation_table_create(); |
| 295 | db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)", nrid); |
| 296 | } |
| 297 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 298 | db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", nrid); |
| 299 | manifest_crosslink(nrid, pWiki); |
| 300 | } |
| 301 | |
| 302 | /* |
| 303 | ** Formal names and common names for the various wiki styles. |
| 304 | */ |
| 305 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -294,11 +294,11 @@ | |
| 294 | moderation_table_create(); |
| 295 | db_multi_exec("INSERT INTO modreq(objid) VALUES(%d)", nrid); |
| 296 | } |
| 297 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 298 | db_multi_exec("INSERT OR IGNORE INTO unclustered VALUES(%d);", nrid); |
| 299 | manifest_crosslink(nrid, pWiki, MC_NONE); |
| 300 | } |
| 301 | |
| 302 | /* |
| 303 | ** Formal names and common names for the various wiki styles. |
| 304 | */ |
| 305 |
+43
-29
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -191,11 +191,11 @@ | ||
| 191 | 191 | if( rid==0 ){ |
| 192 | 192 | blob_appendf(&pXfer->err, "%s", g.zErrMsg); |
| 193 | 193 | blob_reset(&content); |
| 194 | 194 | }else{ |
| 195 | 195 | if( !isPriv ) content_make_public(rid); |
| 196 | - manifest_crosslink(rid, &content); | |
| 196 | + manifest_crosslink(rid, &content, MC_NONE); | |
| 197 | 197 | } |
| 198 | 198 | assert( blob_is_reset(&content) ); |
| 199 | 199 | remote_has(rid); |
| 200 | 200 | } |
| 201 | 201 | |
| @@ -819,31 +819,54 @@ | ||
| 819 | 819 | */ |
| 820 | 820 | static void server_private_xfer_not_authorized(void){ |
| 821 | 821 | @ error not\sauthorized\sto\ssync\sprivate\scontent |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | -static int commonScriptRan = 0; | |
| 824 | +/* | |
| 825 | +** Return the common TH1 code to evaluate prior to evaluating any other | |
| 826 | +** TH1 transfer notification scripts. | |
| 827 | +*/ | |
| 828 | +const char *xfer_common_code(void){ | |
| 829 | + return db_get("xfer-common-script", 0); | |
| 830 | +} | |
| 831 | + | |
| 832 | +/* | |
| 833 | +** Return the TH1 code to evaluate when a push is processed. | |
| 834 | +*/ | |
| 835 | +const char *xfer_push_code(void){ | |
| 836 | + return db_get("xfer-push-script", 0); | |
| 837 | +} | |
| 838 | + | |
| 839 | +/* | |
| 840 | +** Return the TH1 code to evaluate when a commit is processed. | |
| 841 | +*/ | |
| 842 | +const char *xfer_commit_code(void){ | |
| 843 | + return db_get("xfer-commit-script", 0); | |
| 844 | +} | |
| 845 | + | |
| 846 | +/* | |
| 847 | +** Return the TH1 code to evaluate when a ticket change is processed. | |
| 848 | +*/ | |
| 849 | +const char *xfer_ticket_code(void){ | |
| 850 | + return db_get("xfer-ticket-script", 0); | |
| 851 | +} | |
| 825 | 852 | |
| 826 | 853 | /* |
| 827 | 854 | ** Run the specified TH1 script, if any, and returns 1 on error. |
| 828 | 855 | */ |
| 829 | 856 | int xfer_run_script(const char *zScript, const char *zUuid){ |
| 830 | - int result = TH_ERROR; | |
| 831 | - if( !commonScriptRan || !zScript || !(zScript = db_get(zScript, 0))){ | |
| 832 | - /* No script or common script didn't run, return success. */ | |
| 833 | - return TH_OK; | |
| 834 | - } | |
| 835 | - if( commonScriptRan == 1 ){ | |
| 836 | - if( zUuid ){ | |
| 837 | - result = Th_SetVar(g.interp, "uuid", -1, zUuid, -1); | |
| 838 | - if( result!=TH_OK ){ | |
| 839 | - fossil_error(1, "%s", Th_GetResult(g.interp, 0)); | |
| 840 | - return result; | |
| 841 | - } | |
| 842 | - } | |
| 843 | - result = Th_Eval(g.interp, 0, zScript, -1); | |
| 844 | - } | |
| 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); | |
| 845 | 868 | if( result!=TH_OK ){ |
| 846 | 869 | fossil_error(1, "%s", Th_GetResult(g.interp, 0)); |
| 847 | 870 | } |
| 848 | 871 | return result; |
| 849 | 872 | } |
| @@ -850,21 +873,12 @@ | ||
| 850 | 873 | |
| 851 | 874 | /* |
| 852 | 875 | ** Runs the pre-transfer TH1 script, if any, and returns its return code. |
| 853 | 876 | */ |
| 854 | 877 | int xfer_run_common_script(void){ |
| 855 | - int result = 0; | |
| 856 | - if( !commonScriptRan ){ | |
| 857 | - Th_FossilInit(TH_INIT_DEFAULT); /* Make sure TH1 is ready. */ | |
| 858 | - commonScriptRan = 1; /* enable run_script to do something */ | |
| 859 | - result = xfer_run_script("xfer-common-script", 0); | |
| 860 | - if( result == TH_ERROR ){ | |
| 861 | - /* Error message is left in th interpreter. */ | |
| 862 | - commonScriptRan = 2; | |
| 863 | - } | |
| 864 | - } | |
| 865 | - return result; | |
| 878 | + Th_FossilInit(TH_INIT_DEFAULT); | |
| 879 | + return xfer_run_script(xfer_common_code(), 0); | |
| 866 | 880 | } |
| 867 | 881 | |
| 868 | 882 | /* |
| 869 | 883 | ** If this variable is set, disable login checks. Used for debugging |
| 870 | 884 | ** only. |
| @@ -1249,11 +1263,11 @@ | ||
| 1249 | 1263 | } |
| 1250 | 1264 | blobarray_reset(xfer.aToken, xfer.nToken); |
| 1251 | 1265 | blob_reset(&xfer.line); |
| 1252 | 1266 | } |
| 1253 | 1267 | if( isPush ){ |
| 1254 | - if( xfer_run_script("xfer-push-script", 0)!=TH_OK ){ | |
| 1268 | + if( xfer_run_script(xfer_push_code(), 0)!=TH_OK ){ | |
| 1255 | 1269 | cgi_reset_content(); |
| 1256 | 1270 | @ error push\sscript\sfailed:\s%F(g.zErrMsg) |
| 1257 | 1271 | nErr++; |
| 1258 | 1272 | } |
| 1259 | 1273 | request_phantoms(&xfer, 500); |
| 1260 | 1274 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -191,11 +191,11 @@ | |
| 191 | if( rid==0 ){ |
| 192 | blob_appendf(&pXfer->err, "%s", g.zErrMsg); |
| 193 | blob_reset(&content); |
| 194 | }else{ |
| 195 | if( !isPriv ) content_make_public(rid); |
| 196 | manifest_crosslink(rid, &content); |
| 197 | } |
| 198 | assert( blob_is_reset(&content) ); |
| 199 | remote_has(rid); |
| 200 | } |
| 201 | |
| @@ -819,31 +819,54 @@ | |
| 819 | */ |
| 820 | static void server_private_xfer_not_authorized(void){ |
| 821 | @ error not\sauthorized\sto\ssync\sprivate\scontent |
| 822 | } |
| 823 | |
| 824 | static int commonScriptRan = 0; |
| 825 | |
| 826 | /* |
| 827 | ** Run the specified TH1 script, if any, and returns 1 on error. |
| 828 | */ |
| 829 | int xfer_run_script(const char *zScript, const char *zUuid){ |
| 830 | int result = TH_ERROR; |
| 831 | if( !commonScriptRan || !zScript || !(zScript = db_get(zScript, 0))){ |
| 832 | /* No script or common script didn't run, return success. */ |
| 833 | return TH_OK; |
| 834 | } |
| 835 | if( commonScriptRan == 1 ){ |
| 836 | if( zUuid ){ |
| 837 | result = Th_SetVar(g.interp, "uuid", -1, zUuid, -1); |
| 838 | if( result!=TH_OK ){ |
| 839 | fossil_error(1, "%s", Th_GetResult(g.interp, 0)); |
| 840 | return result; |
| 841 | } |
| 842 | } |
| 843 | result = Th_Eval(g.interp, 0, zScript, -1); |
| 844 | } |
| 845 | if( result!=TH_OK ){ |
| 846 | fossil_error(1, "%s", Th_GetResult(g.interp, 0)); |
| 847 | } |
| 848 | return result; |
| 849 | } |
| @@ -850,21 +873,12 @@ | |
| 850 | |
| 851 | /* |
| 852 | ** Runs the pre-transfer TH1 script, if any, and returns its return code. |
| 853 | */ |
| 854 | int xfer_run_common_script(void){ |
| 855 | int result = 0; |
| 856 | if( !commonScriptRan ){ |
| 857 | Th_FossilInit(TH_INIT_DEFAULT); /* Make sure TH1 is ready. */ |
| 858 | commonScriptRan = 1; /* enable run_script to do something */ |
| 859 | result = xfer_run_script("xfer-common-script", 0); |
| 860 | if( result == TH_ERROR ){ |
| 861 | /* Error message is left in th interpreter. */ |
| 862 | commonScriptRan = 2; |
| 863 | } |
| 864 | } |
| 865 | return result; |
| 866 | } |
| 867 | |
| 868 | /* |
| 869 | ** If this variable is set, disable login checks. Used for debugging |
| 870 | ** only. |
| @@ -1249,11 +1263,11 @@ | |
| 1249 | } |
| 1250 | blobarray_reset(xfer.aToken, xfer.nToken); |
| 1251 | blob_reset(&xfer.line); |
| 1252 | } |
| 1253 | if( isPush ){ |
| 1254 | if( xfer_run_script("xfer-push-script", 0)!=TH_OK ){ |
| 1255 | cgi_reset_content(); |
| 1256 | @ error push\sscript\sfailed:\s%F(g.zErrMsg) |
| 1257 | nErr++; |
| 1258 | } |
| 1259 | request_phantoms(&xfer, 500); |
| 1260 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -191,11 +191,11 @@ | |
| 191 | if( rid==0 ){ |
| 192 | blob_appendf(&pXfer->err, "%s", g.zErrMsg); |
| 193 | blob_reset(&content); |
| 194 | }else{ |
| 195 | if( !isPriv ) content_make_public(rid); |
| 196 | manifest_crosslink(rid, &content, MC_NONE); |
| 197 | } |
| 198 | assert( blob_is_reset(&content) ); |
| 199 | remote_has(rid); |
| 200 | } |
| 201 | |
| @@ -819,31 +819,54 @@ | |
| 819 | */ |
| 820 | static void server_private_xfer_not_authorized(void){ |
| 821 | @ error not\sauthorized\sto\ssync\sprivate\scontent |
| 822 | } |
| 823 | |
| 824 | /* |
| 825 | ** Return the common TH1 code to evaluate prior to evaluating any other |
| 826 | ** TH1 transfer notification scripts. |
| 827 | */ |
| 828 | const char *xfer_common_code(void){ |
| 829 | return db_get("xfer-common-script", 0); |
| 830 | } |
| 831 | |
| 832 | /* |
| 833 | ** Return the TH1 code to evaluate when a push is processed. |
| 834 | */ |
| 835 | const char *xfer_push_code(void){ |
| 836 | return db_get("xfer-push-script", 0); |
| 837 | } |
| 838 | |
| 839 | /* |
| 840 | ** Return the TH1 code to evaluate when a commit is processed. |
| 841 | */ |
| 842 | const char *xfer_commit_code(void){ |
| 843 | return db_get("xfer-commit-script", 0); |
| 844 | } |
| 845 | |
| 846 | /* |
| 847 | ** Return the TH1 code to evaluate when a ticket change is processed. |
| 848 | */ |
| 849 | const char *xfer_ticket_code(void){ |
| 850 | return db_get("xfer-ticket-script", 0); |
| 851 | } |
| 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 | } |
| @@ -850,21 +873,12 @@ | |
| 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. |
| @@ -1249,11 +1263,11 @@ | |
| 1263 | } |
| 1264 | blobarray_reset(xfer.aToken, xfer.nToken); |
| 1265 | blob_reset(&xfer.line); |
| 1266 | } |
| 1267 | if( isPush ){ |
| 1268 | if( xfer_run_script(xfer_push_code(), 0)!=TH_OK ){ |
| 1269 | cgi_reset_content(); |
| 1270 | @ error push\sscript\sfailed:\s%F(g.zErrMsg) |
| 1271 | nErr++; |
| 1272 | } |
| 1273 | request_phantoms(&xfer, 500); |
| 1274 |