Fossil SCM

For consistency with the 'tag' and 'reparent' commands, have --dry-run always print the generated control artifact and omit the unchanged summary, and drop --verbose

florian 2018-12-26 07:43 UTC cmd-options-amend
Commit 54928ff4b6855d974555f6e999db356f48ae32b4bb34f16fd53aa36412d2e2f0
1 file changed +14 -23
+14 -23
--- src/info.c
+++ src/info.c
@@ -2494,12 +2494,11 @@
24942494
static void apply_newtags(
24952495
Blob *ctrl,
24962496
int rid,
24972497
const char *zUuid,
24982498
const char *zUserOvrd, /* The user name on the control artifact */
2499
- int fVerbose, /* Print the generated control artifact */
2500
- int fDryRun /* Make no changes, just print what would happen */
2499
+ int fDryRun /* Print control artifact, but make no changes */
25012500
){
25022501
Stmt q;
25032502
int nChng = 0;
25042503
25052504
db_prepare(&q, "SELECT tag, prefix, value FROM newtags"
@@ -2524,29 +2523,22 @@
25242523
}else{
25252524
blob_appendf(ctrl, "U %F\n", login_name());
25262525
}
25272526
md5sum_blob(ctrl, &cksum);
25282527
blob_appendf(ctrl, "Z %b\n", &cksum);
2529
- if( fVerbose!=0 ){
2528
+ if( fDryRun ){
25302529
assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */
2531
- fossil_print("%s\n", blob_str(ctrl));
2532
- }
2533
- if( fDryRun==0 ){
2530
+ fossil_print("%s", blob_str(ctrl));
2531
+ blob_reset(ctrl);
2532
+ }else{
25342533
db_begin_transaction();
25352534
g.markPrivate = content_is_private(rid);
25362535
nrid = content_put(ctrl);
25372536
manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS);
2538
- assert( blob_is_reset(ctrl) );
25392537
db_end_transaction(0);
2540
- }else{
2541
- blob_reset(ctrl);
2542
- }
2543
- }else{
2544
- if( fVerbose!=0 ){
2545
- assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */
2546
- fossil_print("No changes (empty control artifact)\n\n");
2547
- }
2538
+ }
2539
+ assert( blob_is_reset(ctrl) );
25482540
}
25492541
}
25502542
25512543
/*
25522544
** This method checks that the date can be parsed.
@@ -2682,11 +2674,11 @@
26822674
db_finalize(&q);
26832675
if( zHideFlag[0] ) hide_branch();
26842676
if( zCloseFlag[0] ) close_leaf(rid);
26852677
if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag);
26862678
if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch);
2687
- apply_newtags(&ctrl, rid, zUuid, 0, 0, 0);
2679
+ apply_newtags(&ctrl, rid, zUuid, 0, 0);
26882680
cgi_redirectf("%R/ci/%S", zUuid);
26892681
}
26902682
blob_zero(&comment);
26912683
blob_append(&comment, zNewComment, -1);
26922684
zUuid[10] = 0;
@@ -2936,12 +2928,11 @@
29362928
** --tag TAG Add new TAG to this check-in
29372929
** --cancel TAG Cancel TAG from this check-in
29382930
** --branch NAME Make this check-in the start of branch NAME
29392931
** --hide Hide branch starting from this check-in
29402932
** --close Mark this "leaf" as closed
2941
-** -v|--verbose Print the generated control artifact
2942
-** -n|--dry-run Make no changes, just print what would happen
2933
+** -n|--dry-run Print control artifact, but make no changes
29432934
** --date-override DATETIME Set the change time on the control artifact
29442935
** --user-override USER Set the user name on the control artifact
29452936
**
29462937
** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
29472938
** year-month-day form, it may be truncated, the "T" may be replaced by
@@ -2969,12 +2960,11 @@
29692960
int fPropagateColor; /* True if color propagates before amend */
29702961
int fNewPropagateColor = 0; /* True if color propagates after amend */
29712962
int fHasHidden = 0; /* True if hidden tag already set */
29722963
int fHasClosed = 0; /* True if closed tag already set */
29732964
int fEditComment; /* True if editor to be used for comment */
2974
- int fVerbose; /* Print the generated control artifact */
2975
- int fDryRun; /* No changes, just print what would happen */
2965
+ int fDryRun; /* Print control artifact, make no changes */
29762966
const char *zChngTime; /* The change time on the control artifact */
29772967
const char *zUserOvrd; /* The user name on the control artifact */
29782968
const char *zUuid;
29792969
Blob ctrl;
29802970
Blob comment;
@@ -2998,11 +2988,10 @@
29982988
zNewUser = find_option("author",0,1);
29992989
pzNewTags = find_repeatable_option("tag",0,&nTags);
30002990
pzCancelTags = find_repeatable_option("cancel",0,&nCancels);
30012991
fClose = find_option("close",0,0)!=0;
30022992
fHide = find_option("hide",0,0)!=0;
3003
- fVerbose = find_option("verbose","v",0)!=0;
30042993
fDryRun = find_option("dry-run","n",0)!=0;
30052994
if( fDryRun==0 ) fDryRun = find_option("dryrun","n",0)!=0;
30062995
zChngTime = find_option("date-override",0,1);
30072996
if( zChngTime==0 ) zChngTime = find_option("chngtime",0,1);
30082997
zUserOvrd = find_option("user-override",0,1);
@@ -3099,8 +3088,10 @@
30993088
fossil_free((void *)pzCancelTags);
31003089
}
31013090
if( fHide && !fHasHidden ) hide_branch();
31023091
if( fClose && !fHasClosed ) close_leaf(rid);
31033092
if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch);
3104
- apply_newtags(&ctrl, rid, zUuid, zUserOvrd, fVerbose, fDryRun);
3105
- show_common_info(rid, "uuid:", 1, 0);
3093
+ apply_newtags(&ctrl, rid, zUuid, zUserOvrd, fDryRun);
3094
+ if( fDryRun==0 ){
3095
+ show_common_info(rid, "uuid:", 1, 0);
3096
+ }
31063097
}
31073098
--- src/info.c
+++ src/info.c
@@ -2494,12 +2494,11 @@
2494 static void apply_newtags(
2495 Blob *ctrl,
2496 int rid,
2497 const char *zUuid,
2498 const char *zUserOvrd, /* The user name on the control artifact */
2499 int fVerbose, /* Print the generated control artifact */
2500 int fDryRun /* Make no changes, just print what would happen */
2501 ){
2502 Stmt q;
2503 int nChng = 0;
2504
2505 db_prepare(&q, "SELECT tag, prefix, value FROM newtags"
@@ -2524,29 +2523,22 @@
2524 }else{
2525 blob_appendf(ctrl, "U %F\n", login_name());
2526 }
2527 md5sum_blob(ctrl, &cksum);
2528 blob_appendf(ctrl, "Z %b\n", &cksum);
2529 if( fVerbose!=0 ){
2530 assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */
2531 fossil_print("%s\n", blob_str(ctrl));
2532 }
2533 if( fDryRun==0 ){
2534 db_begin_transaction();
2535 g.markPrivate = content_is_private(rid);
2536 nrid = content_put(ctrl);
2537 manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS);
2538 assert( blob_is_reset(ctrl) );
2539 db_end_transaction(0);
2540 }else{
2541 blob_reset(ctrl);
2542 }
2543 }else{
2544 if( fVerbose!=0 ){
2545 assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */
2546 fossil_print("No changes (empty control artifact)\n\n");
2547 }
2548 }
2549 }
2550
2551 /*
2552 ** This method checks that the date can be parsed.
@@ -2682,11 +2674,11 @@
2682 db_finalize(&q);
2683 if( zHideFlag[0] ) hide_branch();
2684 if( zCloseFlag[0] ) close_leaf(rid);
2685 if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag);
2686 if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch);
2687 apply_newtags(&ctrl, rid, zUuid, 0, 0, 0);
2688 cgi_redirectf("%R/ci/%S", zUuid);
2689 }
2690 blob_zero(&comment);
2691 blob_append(&comment, zNewComment, -1);
2692 zUuid[10] = 0;
@@ -2936,12 +2928,11 @@
2936 ** --tag TAG Add new TAG to this check-in
2937 ** --cancel TAG Cancel TAG from this check-in
2938 ** --branch NAME Make this check-in the start of branch NAME
2939 ** --hide Hide branch starting from this check-in
2940 ** --close Mark this "leaf" as closed
2941 ** -v|--verbose Print the generated control artifact
2942 ** -n|--dry-run Make no changes, just print what would happen
2943 ** --date-override DATETIME Set the change time on the control artifact
2944 ** --user-override USER Set the user name on the control artifact
2945 **
2946 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
2947 ** year-month-day form, it may be truncated, the "T" may be replaced by
@@ -2969,12 +2960,11 @@
2969 int fPropagateColor; /* True if color propagates before amend */
2970 int fNewPropagateColor = 0; /* True if color propagates after amend */
2971 int fHasHidden = 0; /* True if hidden tag already set */
2972 int fHasClosed = 0; /* True if closed tag already set */
2973 int fEditComment; /* True if editor to be used for comment */
2974 int fVerbose; /* Print the generated control artifact */
2975 int fDryRun; /* No changes, just print what would happen */
2976 const char *zChngTime; /* The change time on the control artifact */
2977 const char *zUserOvrd; /* The user name on the control artifact */
2978 const char *zUuid;
2979 Blob ctrl;
2980 Blob comment;
@@ -2998,11 +2988,10 @@
2998 zNewUser = find_option("author",0,1);
2999 pzNewTags = find_repeatable_option("tag",0,&nTags);
3000 pzCancelTags = find_repeatable_option("cancel",0,&nCancels);
3001 fClose = find_option("close",0,0)!=0;
3002 fHide = find_option("hide",0,0)!=0;
3003 fVerbose = find_option("verbose","v",0)!=0;
3004 fDryRun = find_option("dry-run","n",0)!=0;
3005 if( fDryRun==0 ) fDryRun = find_option("dryrun","n",0)!=0;
3006 zChngTime = find_option("date-override",0,1);
3007 if( zChngTime==0 ) zChngTime = find_option("chngtime",0,1);
3008 zUserOvrd = find_option("user-override",0,1);
@@ -3099,8 +3088,10 @@
3099 fossil_free((void *)pzCancelTags);
3100 }
3101 if( fHide && !fHasHidden ) hide_branch();
3102 if( fClose && !fHasClosed ) close_leaf(rid);
3103 if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch);
3104 apply_newtags(&ctrl, rid, zUuid, zUserOvrd, fVerbose, fDryRun);
3105 show_common_info(rid, "uuid:", 1, 0);
 
 
3106 }
3107
--- src/info.c
+++ src/info.c
@@ -2494,12 +2494,11 @@
2494 static void apply_newtags(
2495 Blob *ctrl,
2496 int rid,
2497 const char *zUuid,
2498 const char *zUserOvrd, /* The user name on the control artifact */
2499 int fDryRun /* Print control artifact, but make no changes */
 
2500 ){
2501 Stmt q;
2502 int nChng = 0;
2503
2504 db_prepare(&q, "SELECT tag, prefix, value FROM newtags"
@@ -2524,29 +2523,22 @@
2523 }else{
2524 blob_appendf(ctrl, "U %F\n", login_name());
2525 }
2526 md5sum_blob(ctrl, &cksum);
2527 blob_appendf(ctrl, "Z %b\n", &cksum);
2528 if( fDryRun ){
2529 assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */
2530 fossil_print("%s", blob_str(ctrl));
2531 blob_reset(ctrl);
2532 }else{
2533 db_begin_transaction();
2534 g.markPrivate = content_is_private(rid);
2535 nrid = content_put(ctrl);
2536 manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS);
 
2537 db_end_transaction(0);
2538 }
2539 assert( blob_is_reset(ctrl) );
 
 
 
 
 
 
2540 }
2541 }
2542
2543 /*
2544 ** This method checks that the date can be parsed.
@@ -2682,11 +2674,11 @@
2674 db_finalize(&q);
2675 if( zHideFlag[0] ) hide_branch();
2676 if( zCloseFlag[0] ) close_leaf(rid);
2677 if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag);
2678 if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch);
2679 apply_newtags(&ctrl, rid, zUuid, 0, 0);
2680 cgi_redirectf("%R/ci/%S", zUuid);
2681 }
2682 blob_zero(&comment);
2683 blob_append(&comment, zNewComment, -1);
2684 zUuid[10] = 0;
@@ -2936,12 +2928,11 @@
2928 ** --tag TAG Add new TAG to this check-in
2929 ** --cancel TAG Cancel TAG from this check-in
2930 ** --branch NAME Make this check-in the start of branch NAME
2931 ** --hide Hide branch starting from this check-in
2932 ** --close Mark this "leaf" as closed
2933 ** -n|--dry-run Print control artifact, but make no changes
 
2934 ** --date-override DATETIME Set the change time on the control artifact
2935 ** --user-override USER Set the user name on the control artifact
2936 **
2937 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
2938 ** year-month-day form, it may be truncated, the "T" may be replaced by
@@ -2969,12 +2960,11 @@
2960 int fPropagateColor; /* True if color propagates before amend */
2961 int fNewPropagateColor = 0; /* True if color propagates after amend */
2962 int fHasHidden = 0; /* True if hidden tag already set */
2963 int fHasClosed = 0; /* True if closed tag already set */
2964 int fEditComment; /* True if editor to be used for comment */
2965 int fDryRun; /* Print control artifact, make no changes */
 
2966 const char *zChngTime; /* The change time on the control artifact */
2967 const char *zUserOvrd; /* The user name on the control artifact */
2968 const char *zUuid;
2969 Blob ctrl;
2970 Blob comment;
@@ -2998,11 +2988,10 @@
2988 zNewUser = find_option("author",0,1);
2989 pzNewTags = find_repeatable_option("tag",0,&nTags);
2990 pzCancelTags = find_repeatable_option("cancel",0,&nCancels);
2991 fClose = find_option("close",0,0)!=0;
2992 fHide = find_option("hide",0,0)!=0;
 
2993 fDryRun = find_option("dry-run","n",0)!=0;
2994 if( fDryRun==0 ) fDryRun = find_option("dryrun","n",0)!=0;
2995 zChngTime = find_option("date-override",0,1);
2996 if( zChngTime==0 ) zChngTime = find_option("chngtime",0,1);
2997 zUserOvrd = find_option("user-override",0,1);
@@ -3099,8 +3088,10 @@
3088 fossil_free((void *)pzCancelTags);
3089 }
3090 if( fHide && !fHasHidden ) hide_branch();
3091 if( fClose && !fHasClosed ) close_leaf(rid);
3092 if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch);
3093 apply_newtags(&ctrl, rid, zUuid, zUserOvrd, fDryRun);
3094 if( fDryRun==0 ){
3095 show_common_info(rid, "uuid:", 1, 0);
3096 }
3097 }
3098

Keyboard Shortcuts

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