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
Commit
54928ff4b6855d974555f6e999db356f48ae32b4bb34f16fd53aa36412d2e2f0
Parent
36369faab401d5c…
1 file changed
+14
-23
+14
-23
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2494,12 +2494,11 @@ | ||
| 2494 | 2494 | static void apply_newtags( |
| 2495 | 2495 | Blob *ctrl, |
| 2496 | 2496 | int rid, |
| 2497 | 2497 | const char *zUuid, |
| 2498 | 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 */ | |
| 2499 | + int fDryRun /* Print control artifact, but make no changes */ | |
| 2501 | 2500 | ){ |
| 2502 | 2501 | Stmt q; |
| 2503 | 2502 | int nChng = 0; |
| 2504 | 2503 | |
| 2505 | 2504 | db_prepare(&q, "SELECT tag, prefix, value FROM newtags" |
| @@ -2524,29 +2523,22 @@ | ||
| 2524 | 2523 | }else{ |
| 2525 | 2524 | blob_appendf(ctrl, "U %F\n", login_name()); |
| 2526 | 2525 | } |
| 2527 | 2526 | md5sum_blob(ctrl, &cksum); |
| 2528 | 2527 | blob_appendf(ctrl, "Z %b\n", &cksum); |
| 2529 | - if( fVerbose!=0 ){ | |
| 2528 | + if( fDryRun ){ | |
| 2530 | 2529 | 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{ | |
| 2534 | 2533 | db_begin_transaction(); |
| 2535 | 2534 | g.markPrivate = content_is_private(rid); |
| 2536 | 2535 | nrid = content_put(ctrl); |
| 2537 | 2536 | manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS); |
| 2538 | - assert( blob_is_reset(ctrl) ); | |
| 2539 | 2537 | 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) ); | |
| 2548 | 2540 | } |
| 2549 | 2541 | } |
| 2550 | 2542 | |
| 2551 | 2543 | /* |
| 2552 | 2544 | ** This method checks that the date can be parsed. |
| @@ -2682,11 +2674,11 @@ | ||
| 2682 | 2674 | db_finalize(&q); |
| 2683 | 2675 | if( zHideFlag[0] ) hide_branch(); |
| 2684 | 2676 | if( zCloseFlag[0] ) close_leaf(rid); |
| 2685 | 2677 | if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag); |
| 2686 | 2678 | 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); | |
| 2688 | 2680 | cgi_redirectf("%R/ci/%S", zUuid); |
| 2689 | 2681 | } |
| 2690 | 2682 | blob_zero(&comment); |
| 2691 | 2683 | blob_append(&comment, zNewComment, -1); |
| 2692 | 2684 | zUuid[10] = 0; |
| @@ -2936,12 +2928,11 @@ | ||
| 2936 | 2928 | ** --tag TAG Add new TAG to this check-in |
| 2937 | 2929 | ** --cancel TAG Cancel TAG from this check-in |
| 2938 | 2930 | ** --branch NAME Make this check-in the start of branch NAME |
| 2939 | 2931 | ** --hide Hide branch starting from this check-in |
| 2940 | 2932 | ** --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 | |
| 2943 | 2934 | ** --date-override DATETIME Set the change time on the control artifact |
| 2944 | 2935 | ** --user-override USER Set the user name on the control artifact |
| 2945 | 2936 | ** |
| 2946 | 2937 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 2947 | 2938 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| @@ -2969,12 +2960,11 @@ | ||
| 2969 | 2960 | int fPropagateColor; /* True if color propagates before amend */ |
| 2970 | 2961 | int fNewPropagateColor = 0; /* True if color propagates after amend */ |
| 2971 | 2962 | int fHasHidden = 0; /* True if hidden tag already set */ |
| 2972 | 2963 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2973 | 2964 | 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 */ | |
| 2976 | 2966 | const char *zChngTime; /* The change time on the control artifact */ |
| 2977 | 2967 | const char *zUserOvrd; /* The user name on the control artifact */ |
| 2978 | 2968 | const char *zUuid; |
| 2979 | 2969 | Blob ctrl; |
| 2980 | 2970 | Blob comment; |
| @@ -2998,11 +2988,10 @@ | ||
| 2998 | 2988 | zNewUser = find_option("author",0,1); |
| 2999 | 2989 | pzNewTags = find_repeatable_option("tag",0,&nTags); |
| 3000 | 2990 | pzCancelTags = find_repeatable_option("cancel",0,&nCancels); |
| 3001 | 2991 | fClose = find_option("close",0,0)!=0; |
| 3002 | 2992 | fHide = find_option("hide",0,0)!=0; |
| 3003 | - fVerbose = find_option("verbose","v",0)!=0; | |
| 3004 | 2993 | fDryRun = find_option("dry-run","n",0)!=0; |
| 3005 | 2994 | if( fDryRun==0 ) fDryRun = find_option("dryrun","n",0)!=0; |
| 3006 | 2995 | zChngTime = find_option("date-override",0,1); |
| 3007 | 2996 | if( zChngTime==0 ) zChngTime = find_option("chngtime",0,1); |
| 3008 | 2997 | zUserOvrd = find_option("user-override",0,1); |
| @@ -3099,8 +3088,10 @@ | ||
| 3099 | 3088 | fossil_free((void *)pzCancelTags); |
| 3100 | 3089 | } |
| 3101 | 3090 | if( fHide && !fHasHidden ) hide_branch(); |
| 3102 | 3091 | if( fClose && !fHasClosed ) close_leaf(rid); |
| 3103 | 3092 | 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 | + } | |
| 3106 | 3097 | } |
| 3107 | 3098 |
| --- 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 |