Fossil SCM
branch close: dry-run mode no longer skips the saving steps.
Commit
a6a1a3cf0cc6a8ccfddf3a082f25d872ecfb66601222c2fab08062bae11db7b5
Parent
0bdb19f3d333268…
1 file changed
+15
-8
+15
-8
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -402,28 +402,35 @@ | ||
| 402 | 402 | blob_appendf(&manifest, "T +closed %s\n", zHash); |
| 403 | 403 | } |
| 404 | 404 | user_select(); |
| 405 | 405 | blob_appendf(&manifest, "U %F\n", login_name()); |
| 406 | 406 | db_finalize(&q); |
| 407 | + if(fDryRun){ | |
| 408 | + fossil_print("Dry-run mode: will roll back new artifact:\n%b", | |
| 409 | + &manifest); | |
| 410 | + /* Run through the saving steps, though, noting that doing so | |
| 411 | + ** will clear out &manifest. */ | |
| 412 | + } | |
| 407 | 413 | { |
| 414 | + int newRid; | |
| 408 | 415 | Blob cksum = empty_blob; |
| 409 | 416 | md5sum_blob(&manifest, &cksum); |
| 410 | 417 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 411 | 418 | blob_reset(&cksum); |
| 412 | - } | |
| 413 | - if(fDryRun){ | |
| 414 | - fossil_print("Dry-run mode. Not saving control artifact:\n%b", | |
| 415 | - &manifest); | |
| 416 | - }else{ | |
| 417 | - const int newRid = content_put(&manifest); | |
| 419 | + newRid = content_put(&manifest); | |
| 418 | 420 | if(0==newRid){ |
| 419 | - fossil_fatal("Problem saving new manifest: %s\n%b", | |
| 421 | + fossil_fatal("Problem saving new artifact: %s\n%b", | |
| 420 | 422 | g.zErrMsg, &manifest); |
| 421 | 423 | }else if(manifest_crosslink(newRid, &manifest, 0)==0){ |
| 422 | 424 | fossil_fatal("Crosslinking error: %s", g.zErrMsg); |
| 423 | 425 | } |
| 424 | - fossil_print("Saved new control artifact (RID %d)\n", newRid); | |
| 426 | + fossil_print("Saved new control artifact %z (RID %d).\n", | |
| 427 | + rid_to_uuid(newRid), newRid); | |
| 428 | + if(fDryRun){ | |
| 429 | + fossil_print("Dry-run mode: rolling back new artifact.\n"); | |
| 430 | + assert(doRollback!=0); | |
| 431 | + } | |
| 425 | 432 | } |
| 426 | 433 | blob_reset(&manifest); |
| 427 | 434 | br_close_end: |
| 428 | 435 | db_multi_exec("DROP TABLE brclose"); |
| 429 | 436 | db_end_transaction(doRollback); |
| 430 | 437 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -402,28 +402,35 @@ | |
| 402 | blob_appendf(&manifest, "T +closed %s\n", zHash); |
| 403 | } |
| 404 | user_select(); |
| 405 | blob_appendf(&manifest, "U %F\n", login_name()); |
| 406 | db_finalize(&q); |
| 407 | { |
| 408 | Blob cksum = empty_blob; |
| 409 | md5sum_blob(&manifest, &cksum); |
| 410 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 411 | blob_reset(&cksum); |
| 412 | } |
| 413 | if(fDryRun){ |
| 414 | fossil_print("Dry-run mode. Not saving control artifact:\n%b", |
| 415 | &manifest); |
| 416 | }else{ |
| 417 | const int newRid = content_put(&manifest); |
| 418 | if(0==newRid){ |
| 419 | fossil_fatal("Problem saving new manifest: %s\n%b", |
| 420 | g.zErrMsg, &manifest); |
| 421 | }else if(manifest_crosslink(newRid, &manifest, 0)==0){ |
| 422 | fossil_fatal("Crosslinking error: %s", g.zErrMsg); |
| 423 | } |
| 424 | fossil_print("Saved new control artifact (RID %d)\n", newRid); |
| 425 | } |
| 426 | blob_reset(&manifest); |
| 427 | br_close_end: |
| 428 | db_multi_exec("DROP TABLE brclose"); |
| 429 | db_end_transaction(doRollback); |
| 430 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -402,28 +402,35 @@ | |
| 402 | blob_appendf(&manifest, "T +closed %s\n", zHash); |
| 403 | } |
| 404 | user_select(); |
| 405 | blob_appendf(&manifest, "U %F\n", login_name()); |
| 406 | db_finalize(&q); |
| 407 | if(fDryRun){ |
| 408 | fossil_print("Dry-run mode: will roll back new artifact:\n%b", |
| 409 | &manifest); |
| 410 | /* Run through the saving steps, though, noting that doing so |
| 411 | ** will clear out &manifest. */ |
| 412 | } |
| 413 | { |
| 414 | int newRid; |
| 415 | Blob cksum = empty_blob; |
| 416 | md5sum_blob(&manifest, &cksum); |
| 417 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 418 | blob_reset(&cksum); |
| 419 | newRid = content_put(&manifest); |
| 420 | if(0==newRid){ |
| 421 | fossil_fatal("Problem saving new artifact: %s\n%b", |
| 422 | g.zErrMsg, &manifest); |
| 423 | }else if(manifest_crosslink(newRid, &manifest, 0)==0){ |
| 424 | fossil_fatal("Crosslinking error: %s", g.zErrMsg); |
| 425 | } |
| 426 | fossil_print("Saved new control artifact %z (RID %d).\n", |
| 427 | rid_to_uuid(newRid), newRid); |
| 428 | if(fDryRun){ |
| 429 | fossil_print("Dry-run mode: rolling back new artifact.\n"); |
| 430 | assert(doRollback!=0); |
| 431 | } |
| 432 | } |
| 433 | blob_reset(&manifest); |
| 434 | br_close_end: |
| 435 | db_multi_exec("DROP TABLE brclose"); |
| 436 | db_end_transaction(doRollback); |
| 437 |