Fossil SCM

branch close: dry-run mode no longer skips the saving steps.

stephan 2021-07-22 06:16 branch-close-subcommand
Commit a6a1a3cf0cc6a8ccfddf3a082f25d872ecfb66601222c2fab08062bae11db7b5
1 file changed +15 -8
+15 -8
--- src/branch.c
+++ src/branch.c
@@ -402,28 +402,35 @@
402402
blob_appendf(&manifest, "T +closed %s\n", zHash);
403403
}
404404
user_select();
405405
blob_appendf(&manifest, "U %F\n", login_name());
406406
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
+ }
407413
{
414
+ int newRid;
408415
Blob cksum = empty_blob;
409416
md5sum_blob(&manifest, &cksum);
410417
blob_appendf(&manifest, "Z %b\n", &cksum);
411418
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);
418420
if(0==newRid){
419
- fossil_fatal("Problem saving new manifest: %s\n%b",
421
+ fossil_fatal("Problem saving new artifact: %s\n%b",
420422
g.zErrMsg, &manifest);
421423
}else if(manifest_crosslink(newRid, &manifest, 0)==0){
422424
fossil_fatal("Crosslinking error: %s", g.zErrMsg);
423425
}
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
+ }
425432
}
426433
blob_reset(&manifest);
427434
br_close_end:
428435
db_multi_exec("DROP TABLE brclose");
429436
db_end_transaction(doRollback);
430437
--- 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

Keyboard Shortcuts

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