Fossil SCM
General enhancements to the "amend", "tag", and "reparent" command, including adding flags like --override-date, --override-user, and --dry-run.
Commit
5c9955710fc68466e3818f768fc8bebb18ccc4706a5a0395f84052df7fa0208d
Parent
efb903f939df4b9…
4 files changed
+38
-11
+38
-11
+28
-7
+28
-7
+38
-11
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2511,11 +2511,17 @@ | ||
| 2511 | 2511 | |
| 2512 | 2512 | /* |
| 2513 | 2513 | ** The apply_newtags method is called after all newtags have been added |
| 2514 | 2514 | ** and the control artifact is completed and then written to the DB. |
| 2515 | 2515 | */ |
| 2516 | -static void apply_newtags(Blob *ctrl, int rid, const char *zUuid){ | |
| 2516 | +static void apply_newtags( | |
| 2517 | + Blob *ctrl, | |
| 2518 | + int rid, | |
| 2519 | + const char *zUuid, | |
| 2520 | + const char *zUserOvrd, /* The user name on the control artifact */ | |
| 2521 | + int fDryRun /* Print control artifact, but make no changes */ | |
| 2522 | +){ | |
| 2517 | 2523 | Stmt q; |
| 2518 | 2524 | int nChng = 0; |
| 2519 | 2525 | |
| 2520 | 2526 | db_prepare(&q, "SELECT tag, prefix, value FROM newtags" |
| 2521 | 2527 | " ORDER BY prefix || tag"); |
| @@ -2532,19 +2538,29 @@ | ||
| 2532 | 2538 | } |
| 2533 | 2539 | db_finalize(&q); |
| 2534 | 2540 | if( nChng>0 ){ |
| 2535 | 2541 | int nrid; |
| 2536 | 2542 | Blob cksum; |
| 2537 | - blob_appendf(ctrl, "U %F\n", login_name()); | |
| 2543 | + if( zUserOvrd && zUserOvrd[0] ){ | |
| 2544 | + blob_appendf(ctrl, "U %F\n", zUserOvrd); | |
| 2545 | + }else{ | |
| 2546 | + blob_appendf(ctrl, "U %F\n", login_name()); | |
| 2547 | + } | |
| 2538 | 2548 | md5sum_blob(ctrl, &cksum); |
| 2539 | 2549 | blob_appendf(ctrl, "Z %b\n", &cksum); |
| 2540 | - db_begin_transaction(); | |
| 2541 | - g.markPrivate = content_is_private(rid); | |
| 2542 | - nrid = content_put(ctrl); | |
| 2543 | - manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS); | |
| 2550 | + if( fDryRun ){ | |
| 2551 | + assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */ | |
| 2552 | + fossil_print("%s", blob_str(ctrl)); | |
| 2553 | + blob_reset(ctrl); | |
| 2554 | + }else{ | |
| 2555 | + db_begin_transaction(); | |
| 2556 | + g.markPrivate = content_is_private(rid); | |
| 2557 | + nrid = content_put(ctrl); | |
| 2558 | + manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS); | |
| 2559 | + db_end_transaction(0); | |
| 2560 | + } | |
| 2544 | 2561 | assert( blob_is_reset(ctrl) ); |
| 2545 | - db_end_transaction(0); | |
| 2546 | 2562 | } |
| 2547 | 2563 | } |
| 2548 | 2564 | |
| 2549 | 2565 | /* |
| 2550 | 2566 | ** This method checks that the date can be parsed. |
| @@ -2680,11 +2696,11 @@ | ||
| 2680 | 2696 | db_finalize(&q); |
| 2681 | 2697 | if( zHideFlag[0] ) hide_branch(); |
| 2682 | 2698 | if( zCloseFlag[0] ) close_leaf(rid); |
| 2683 | 2699 | if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag); |
| 2684 | 2700 | if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 2685 | - apply_newtags(&ctrl, rid, zUuid); | |
| 2701 | + apply_newtags(&ctrl, rid, zUuid, 0, 0); | |
| 2686 | 2702 | cgi_redirectf("%R/ci/%S", zUuid); |
| 2687 | 2703 | } |
| 2688 | 2704 | blob_zero(&comment); |
| 2689 | 2705 | blob_append(&comment, zNewComment, -1); |
| 2690 | 2706 | zUuid[10] = 0; |
| @@ -2934,10 +2950,13 @@ | ||
| 2934 | 2950 | ** --tag TAG Add new TAG to this check-in |
| 2935 | 2951 | ** --cancel TAG Cancel TAG from this check-in |
| 2936 | 2952 | ** --branch NAME Make this check-in the start of branch NAME |
| 2937 | 2953 | ** --hide Hide branch starting from this check-in |
| 2938 | 2954 | ** --close Mark this "leaf" as closed |
| 2955 | +** -n|--dry-run Print control artifact, but make no changes | |
| 2956 | +** --date-override DATETIME Set the change time on the control artifact | |
| 2957 | +** --user-override USER Set the user name on the control artifact | |
| 2939 | 2958 | ** |
| 2940 | 2959 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 2941 | 2960 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 2942 | 2961 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 2943 | 2962 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| @@ -2963,11 +2982,13 @@ | ||
| 2963 | 2982 | int fPropagateColor; /* True if color propagates before amend */ |
| 2964 | 2983 | int fNewPropagateColor = 0; /* True if color propagates after amend */ |
| 2965 | 2984 | int fHasHidden = 0; /* True if hidden tag already set */ |
| 2966 | 2985 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2967 | 2986 | int fEditComment; /* True if editor to be used for comment */ |
| 2987 | + int fDryRun; /* Print control artifact, make no changes */ | |
| 2968 | 2988 | const char *zChngTime; /* The change time on the control artifact */ |
| 2989 | + const char *zUserOvrd; /* The user name on the control artifact */ | |
| 2969 | 2990 | const char *zUuid; |
| 2970 | 2991 | Blob ctrl; |
| 2971 | 2992 | Blob comment; |
| 2972 | 2993 | char *zNow; |
| 2973 | 2994 | int nTags, nCancels; |
| @@ -2989,11 +3010,15 @@ | ||
| 2989 | 3010 | zNewUser = find_option("author",0,1); |
| 2990 | 3011 | pzNewTags = find_repeatable_option("tag",0,&nTags); |
| 2991 | 3012 | pzCancelTags = find_repeatable_option("cancel",0,&nCancels); |
| 2992 | 3013 | fClose = find_option("close",0,0)!=0; |
| 2993 | 3014 | fHide = find_option("hide",0,0)!=0; |
| 2994 | - zChngTime = find_option("chngtime",0,1); | |
| 3015 | + fDryRun = find_option("dry-run","n",0)!=0; | |
| 3016 | + if( fDryRun==0 ) fDryRun = find_option("dryrun","n",0)!=0; | |
| 3017 | + zChngTime = find_option("date-override",0,1); | |
| 3018 | + if( zChngTime==0 ) zChngTime = find_option("chngtime",0,1); | |
| 3019 | + zUserOvrd = find_option("user-override",0,1); | |
| 2995 | 3020 | db_find_and_open_repository(0,0); |
| 2996 | 3021 | user_select(); |
| 2997 | 3022 | verify_all_options(); |
| 2998 | 3023 | if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT); |
| 2999 | 3024 | rid = name_to_typed_rid(g.argv[2], "ci"); |
| @@ -3085,8 +3110,10 @@ | ||
| 3085 | 3110 | fossil_free((void *)pzCancelTags); |
| 3086 | 3111 | } |
| 3087 | 3112 | if( fHide && !fHasHidden ) hide_branch(); |
| 3088 | 3113 | if( fClose && !fHasClosed ) close_leaf(rid); |
| 3089 | 3114 | if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 3090 | - apply_newtags(&ctrl, rid, zUuid); | |
| 3091 | - show_common_info(rid, "uuid:", 1, 0); | |
| 3115 | + apply_newtags(&ctrl, rid, zUuid, zUserOvrd, fDryRun); | |
| 3116 | + if( fDryRun==0 ){ | |
| 3117 | + show_common_info(rid, "uuid:", 1, 0); | |
| 3118 | + } | |
| 3092 | 3119 | } |
| 3093 | 3120 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2511,11 +2511,17 @@ | |
| 2511 | |
| 2512 | /* |
| 2513 | ** The apply_newtags method is called after all newtags have been added |
| 2514 | ** and the control artifact is completed and then written to the DB. |
| 2515 | */ |
| 2516 | static void apply_newtags(Blob *ctrl, int rid, const char *zUuid){ |
| 2517 | Stmt q; |
| 2518 | int nChng = 0; |
| 2519 | |
| 2520 | db_prepare(&q, "SELECT tag, prefix, value FROM newtags" |
| 2521 | " ORDER BY prefix || tag"); |
| @@ -2532,19 +2538,29 @@ | |
| 2532 | } |
| 2533 | db_finalize(&q); |
| 2534 | if( nChng>0 ){ |
| 2535 | int nrid; |
| 2536 | Blob cksum; |
| 2537 | blob_appendf(ctrl, "U %F\n", login_name()); |
| 2538 | md5sum_blob(ctrl, &cksum); |
| 2539 | blob_appendf(ctrl, "Z %b\n", &cksum); |
| 2540 | db_begin_transaction(); |
| 2541 | g.markPrivate = content_is_private(rid); |
| 2542 | nrid = content_put(ctrl); |
| 2543 | manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS); |
| 2544 | assert( blob_is_reset(ctrl) ); |
| 2545 | db_end_transaction(0); |
| 2546 | } |
| 2547 | } |
| 2548 | |
| 2549 | /* |
| 2550 | ** This method checks that the date can be parsed. |
| @@ -2680,11 +2696,11 @@ | |
| 2680 | db_finalize(&q); |
| 2681 | if( zHideFlag[0] ) hide_branch(); |
| 2682 | if( zCloseFlag[0] ) close_leaf(rid); |
| 2683 | if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag); |
| 2684 | if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 2685 | apply_newtags(&ctrl, rid, zUuid); |
| 2686 | cgi_redirectf("%R/ci/%S", zUuid); |
| 2687 | } |
| 2688 | blob_zero(&comment); |
| 2689 | blob_append(&comment, zNewComment, -1); |
| 2690 | zUuid[10] = 0; |
| @@ -2934,10 +2950,13 @@ | |
| 2934 | ** --tag TAG Add new TAG to this check-in |
| 2935 | ** --cancel TAG Cancel TAG from this check-in |
| 2936 | ** --branch NAME Make this check-in the start of branch NAME |
| 2937 | ** --hide Hide branch starting from this check-in |
| 2938 | ** --close Mark this "leaf" as closed |
| 2939 | ** |
| 2940 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 2941 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 2942 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 2943 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| @@ -2963,11 +2982,13 @@ | |
| 2963 | int fPropagateColor; /* True if color propagates before amend */ |
| 2964 | int fNewPropagateColor = 0; /* True if color propagates after amend */ |
| 2965 | int fHasHidden = 0; /* True if hidden tag already set */ |
| 2966 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2967 | int fEditComment; /* True if editor to be used for comment */ |
| 2968 | const char *zChngTime; /* The change time on the control artifact */ |
| 2969 | const char *zUuid; |
| 2970 | Blob ctrl; |
| 2971 | Blob comment; |
| 2972 | char *zNow; |
| 2973 | int nTags, nCancels; |
| @@ -2989,11 +3010,15 @@ | |
| 2989 | zNewUser = find_option("author",0,1); |
| 2990 | pzNewTags = find_repeatable_option("tag",0,&nTags); |
| 2991 | pzCancelTags = find_repeatable_option("cancel",0,&nCancels); |
| 2992 | fClose = find_option("close",0,0)!=0; |
| 2993 | fHide = find_option("hide",0,0)!=0; |
| 2994 | zChngTime = find_option("chngtime",0,1); |
| 2995 | db_find_and_open_repository(0,0); |
| 2996 | user_select(); |
| 2997 | verify_all_options(); |
| 2998 | if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT); |
| 2999 | rid = name_to_typed_rid(g.argv[2], "ci"); |
| @@ -3085,8 +3110,10 @@ | |
| 3085 | fossil_free((void *)pzCancelTags); |
| 3086 | } |
| 3087 | if( fHide && !fHasHidden ) hide_branch(); |
| 3088 | if( fClose && !fHasClosed ) close_leaf(rid); |
| 3089 | if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 3090 | apply_newtags(&ctrl, rid, zUuid); |
| 3091 | show_common_info(rid, "uuid:", 1, 0); |
| 3092 | } |
| 3093 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2511,11 +2511,17 @@ | |
| 2511 | |
| 2512 | /* |
| 2513 | ** The apply_newtags method is called after all newtags have been added |
| 2514 | ** and the control artifact is completed and then written to the DB. |
| 2515 | */ |
| 2516 | static void apply_newtags( |
| 2517 | Blob *ctrl, |
| 2518 | int rid, |
| 2519 | const char *zUuid, |
| 2520 | const char *zUserOvrd, /* The user name on the control artifact */ |
| 2521 | int fDryRun /* Print control artifact, but make no changes */ |
| 2522 | ){ |
| 2523 | Stmt q; |
| 2524 | int nChng = 0; |
| 2525 | |
| 2526 | db_prepare(&q, "SELECT tag, prefix, value FROM newtags" |
| 2527 | " ORDER BY prefix || tag"); |
| @@ -2532,19 +2538,29 @@ | |
| 2538 | } |
| 2539 | db_finalize(&q); |
| 2540 | if( nChng>0 ){ |
| 2541 | int nrid; |
| 2542 | Blob cksum; |
| 2543 | if( zUserOvrd && zUserOvrd[0] ){ |
| 2544 | blob_appendf(ctrl, "U %F\n", zUserOvrd); |
| 2545 | }else{ |
| 2546 | blob_appendf(ctrl, "U %F\n", login_name()); |
| 2547 | } |
| 2548 | md5sum_blob(ctrl, &cksum); |
| 2549 | blob_appendf(ctrl, "Z %b\n", &cksum); |
| 2550 | if( fDryRun ){ |
| 2551 | assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */ |
| 2552 | fossil_print("%s", blob_str(ctrl)); |
| 2553 | blob_reset(ctrl); |
| 2554 | }else{ |
| 2555 | db_begin_transaction(); |
| 2556 | g.markPrivate = content_is_private(rid); |
| 2557 | nrid = content_put(ctrl); |
| 2558 | manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS); |
| 2559 | db_end_transaction(0); |
| 2560 | } |
| 2561 | assert( blob_is_reset(ctrl) ); |
| 2562 | } |
| 2563 | } |
| 2564 | |
| 2565 | /* |
| 2566 | ** This method checks that the date can be parsed. |
| @@ -2680,11 +2696,11 @@ | |
| 2696 | db_finalize(&q); |
| 2697 | if( zHideFlag[0] ) hide_branch(); |
| 2698 | if( zCloseFlag[0] ) close_leaf(rid); |
| 2699 | if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag); |
| 2700 | if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 2701 | apply_newtags(&ctrl, rid, zUuid, 0, 0); |
| 2702 | cgi_redirectf("%R/ci/%S", zUuid); |
| 2703 | } |
| 2704 | blob_zero(&comment); |
| 2705 | blob_append(&comment, zNewComment, -1); |
| 2706 | zUuid[10] = 0; |
| @@ -2934,10 +2950,13 @@ | |
| 2950 | ** --tag TAG Add new TAG to this check-in |
| 2951 | ** --cancel TAG Cancel TAG from this check-in |
| 2952 | ** --branch NAME Make this check-in the start of branch NAME |
| 2953 | ** --hide Hide branch starting from this check-in |
| 2954 | ** --close Mark this "leaf" as closed |
| 2955 | ** -n|--dry-run Print control artifact, but make no changes |
| 2956 | ** --date-override DATETIME Set the change time on the control artifact |
| 2957 | ** --user-override USER Set the user name on the control artifact |
| 2958 | ** |
| 2959 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 2960 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 2961 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 2962 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| @@ -2963,11 +2982,13 @@ | |
| 2982 | int fPropagateColor; /* True if color propagates before amend */ |
| 2983 | int fNewPropagateColor = 0; /* True if color propagates after amend */ |
| 2984 | int fHasHidden = 0; /* True if hidden tag already set */ |
| 2985 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2986 | int fEditComment; /* True if editor to be used for comment */ |
| 2987 | int fDryRun; /* Print control artifact, make no changes */ |
| 2988 | const char *zChngTime; /* The change time on the control artifact */ |
| 2989 | const char *zUserOvrd; /* The user name on the control artifact */ |
| 2990 | const char *zUuid; |
| 2991 | Blob ctrl; |
| 2992 | Blob comment; |
| 2993 | char *zNow; |
| 2994 | int nTags, nCancels; |
| @@ -2989,11 +3010,15 @@ | |
| 3010 | zNewUser = find_option("author",0,1); |
| 3011 | pzNewTags = find_repeatable_option("tag",0,&nTags); |
| 3012 | pzCancelTags = find_repeatable_option("cancel",0,&nCancels); |
| 3013 | fClose = find_option("close",0,0)!=0; |
| 3014 | fHide = find_option("hide",0,0)!=0; |
| 3015 | fDryRun = find_option("dry-run","n",0)!=0; |
| 3016 | if( fDryRun==0 ) fDryRun = find_option("dryrun","n",0)!=0; |
| 3017 | zChngTime = find_option("date-override",0,1); |
| 3018 | if( zChngTime==0 ) zChngTime = find_option("chngtime",0,1); |
| 3019 | zUserOvrd = find_option("user-override",0,1); |
| 3020 | db_find_and_open_repository(0,0); |
| 3021 | user_select(); |
| 3022 | verify_all_options(); |
| 3023 | if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT); |
| 3024 | rid = name_to_typed_rid(g.argv[2], "ci"); |
| @@ -3085,8 +3110,10 @@ | |
| 3110 | fossil_free((void *)pzCancelTags); |
| 3111 | } |
| 3112 | if( fHide && !fHasHidden ) hide_branch(); |
| 3113 | if( fClose && !fHasClosed ) close_leaf(rid); |
| 3114 | if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 3115 | apply_newtags(&ctrl, rid, zUuid, zUserOvrd, fDryRun); |
| 3116 | if( fDryRun==0 ){ |
| 3117 | show_common_info(rid, "uuid:", 1, 0); |
| 3118 | } |
| 3119 | } |
| 3120 |
+38
-11
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2511,11 +2511,17 @@ | ||
| 2511 | 2511 | |
| 2512 | 2512 | /* |
| 2513 | 2513 | ** The apply_newtags method is called after all newtags have been added |
| 2514 | 2514 | ** and the control artifact is completed and then written to the DB. |
| 2515 | 2515 | */ |
| 2516 | -static void apply_newtags(Blob *ctrl, int rid, const char *zUuid){ | |
| 2516 | +static void apply_newtags( | |
| 2517 | + Blob *ctrl, | |
| 2518 | + int rid, | |
| 2519 | + const char *zUuid, | |
| 2520 | + const char *zUserOvrd, /* The user name on the control artifact */ | |
| 2521 | + int fDryRun /* Print control artifact, but make no changes */ | |
| 2522 | +){ | |
| 2517 | 2523 | Stmt q; |
| 2518 | 2524 | int nChng = 0; |
| 2519 | 2525 | |
| 2520 | 2526 | db_prepare(&q, "SELECT tag, prefix, value FROM newtags" |
| 2521 | 2527 | " ORDER BY prefix || tag"); |
| @@ -2532,19 +2538,29 @@ | ||
| 2532 | 2538 | } |
| 2533 | 2539 | db_finalize(&q); |
| 2534 | 2540 | if( nChng>0 ){ |
| 2535 | 2541 | int nrid; |
| 2536 | 2542 | Blob cksum; |
| 2537 | - blob_appendf(ctrl, "U %F\n", login_name()); | |
| 2543 | + if( zUserOvrd && zUserOvrd[0] ){ | |
| 2544 | + blob_appendf(ctrl, "U %F\n", zUserOvrd); | |
| 2545 | + }else{ | |
| 2546 | + blob_appendf(ctrl, "U %F\n", login_name()); | |
| 2547 | + } | |
| 2538 | 2548 | md5sum_blob(ctrl, &cksum); |
| 2539 | 2549 | blob_appendf(ctrl, "Z %b\n", &cksum); |
| 2540 | - db_begin_transaction(); | |
| 2541 | - g.markPrivate = content_is_private(rid); | |
| 2542 | - nrid = content_put(ctrl); | |
| 2543 | - manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS); | |
| 2550 | + if( fDryRun ){ | |
| 2551 | + assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */ | |
| 2552 | + fossil_print("%s", blob_str(ctrl)); | |
| 2553 | + blob_reset(ctrl); | |
| 2554 | + }else{ | |
| 2555 | + db_begin_transaction(); | |
| 2556 | + g.markPrivate = content_is_private(rid); | |
| 2557 | + nrid = content_put(ctrl); | |
| 2558 | + manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS); | |
| 2559 | + db_end_transaction(0); | |
| 2560 | + } | |
| 2544 | 2561 | assert( blob_is_reset(ctrl) ); |
| 2545 | - db_end_transaction(0); | |
| 2546 | 2562 | } |
| 2547 | 2563 | } |
| 2548 | 2564 | |
| 2549 | 2565 | /* |
| 2550 | 2566 | ** This method checks that the date can be parsed. |
| @@ -2680,11 +2696,11 @@ | ||
| 2680 | 2696 | db_finalize(&q); |
| 2681 | 2697 | if( zHideFlag[0] ) hide_branch(); |
| 2682 | 2698 | if( zCloseFlag[0] ) close_leaf(rid); |
| 2683 | 2699 | if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag); |
| 2684 | 2700 | if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 2685 | - apply_newtags(&ctrl, rid, zUuid); | |
| 2701 | + apply_newtags(&ctrl, rid, zUuid, 0, 0); | |
| 2686 | 2702 | cgi_redirectf("%R/ci/%S", zUuid); |
| 2687 | 2703 | } |
| 2688 | 2704 | blob_zero(&comment); |
| 2689 | 2705 | blob_append(&comment, zNewComment, -1); |
| 2690 | 2706 | zUuid[10] = 0; |
| @@ -2934,10 +2950,13 @@ | ||
| 2934 | 2950 | ** --tag TAG Add new TAG to this check-in |
| 2935 | 2951 | ** --cancel TAG Cancel TAG from this check-in |
| 2936 | 2952 | ** --branch NAME Make this check-in the start of branch NAME |
| 2937 | 2953 | ** --hide Hide branch starting from this check-in |
| 2938 | 2954 | ** --close Mark this "leaf" as closed |
| 2955 | +** -n|--dry-run Print control artifact, but make no changes | |
| 2956 | +** --date-override DATETIME Set the change time on the control artifact | |
| 2957 | +** --user-override USER Set the user name on the control artifact | |
| 2939 | 2958 | ** |
| 2940 | 2959 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 2941 | 2960 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 2942 | 2961 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 2943 | 2962 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| @@ -2963,11 +2982,13 @@ | ||
| 2963 | 2982 | int fPropagateColor; /* True if color propagates before amend */ |
| 2964 | 2983 | int fNewPropagateColor = 0; /* True if color propagates after amend */ |
| 2965 | 2984 | int fHasHidden = 0; /* True if hidden tag already set */ |
| 2966 | 2985 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2967 | 2986 | int fEditComment; /* True if editor to be used for comment */ |
| 2987 | + int fDryRun; /* Print control artifact, make no changes */ | |
| 2968 | 2988 | const char *zChngTime; /* The change time on the control artifact */ |
| 2989 | + const char *zUserOvrd; /* The user name on the control artifact */ | |
| 2969 | 2990 | const char *zUuid; |
| 2970 | 2991 | Blob ctrl; |
| 2971 | 2992 | Blob comment; |
| 2972 | 2993 | char *zNow; |
| 2973 | 2994 | int nTags, nCancels; |
| @@ -2989,11 +3010,15 @@ | ||
| 2989 | 3010 | zNewUser = find_option("author",0,1); |
| 2990 | 3011 | pzNewTags = find_repeatable_option("tag",0,&nTags); |
| 2991 | 3012 | pzCancelTags = find_repeatable_option("cancel",0,&nCancels); |
| 2992 | 3013 | fClose = find_option("close",0,0)!=0; |
| 2993 | 3014 | fHide = find_option("hide",0,0)!=0; |
| 2994 | - zChngTime = find_option("chngtime",0,1); | |
| 3015 | + fDryRun = find_option("dry-run","n",0)!=0; | |
| 3016 | + if( fDryRun==0 ) fDryRun = find_option("dryrun","n",0)!=0; | |
| 3017 | + zChngTime = find_option("date-override",0,1); | |
| 3018 | + if( zChngTime==0 ) zChngTime = find_option("chngtime",0,1); | |
| 3019 | + zUserOvrd = find_option("user-override",0,1); | |
| 2995 | 3020 | db_find_and_open_repository(0,0); |
| 2996 | 3021 | user_select(); |
| 2997 | 3022 | verify_all_options(); |
| 2998 | 3023 | if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT); |
| 2999 | 3024 | rid = name_to_typed_rid(g.argv[2], "ci"); |
| @@ -3085,8 +3110,10 @@ | ||
| 3085 | 3110 | fossil_free((void *)pzCancelTags); |
| 3086 | 3111 | } |
| 3087 | 3112 | if( fHide && !fHasHidden ) hide_branch(); |
| 3088 | 3113 | if( fClose && !fHasClosed ) close_leaf(rid); |
| 3089 | 3114 | if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 3090 | - apply_newtags(&ctrl, rid, zUuid); | |
| 3091 | - show_common_info(rid, "uuid:", 1, 0); | |
| 3115 | + apply_newtags(&ctrl, rid, zUuid, zUserOvrd, fDryRun); | |
| 3116 | + if( fDryRun==0 ){ | |
| 3117 | + show_common_info(rid, "uuid:", 1, 0); | |
| 3118 | + } | |
| 3092 | 3119 | } |
| 3093 | 3120 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2511,11 +2511,17 @@ | |
| 2511 | |
| 2512 | /* |
| 2513 | ** The apply_newtags method is called after all newtags have been added |
| 2514 | ** and the control artifact is completed and then written to the DB. |
| 2515 | */ |
| 2516 | static void apply_newtags(Blob *ctrl, int rid, const char *zUuid){ |
| 2517 | Stmt q; |
| 2518 | int nChng = 0; |
| 2519 | |
| 2520 | db_prepare(&q, "SELECT tag, prefix, value FROM newtags" |
| 2521 | " ORDER BY prefix || tag"); |
| @@ -2532,19 +2538,29 @@ | |
| 2532 | } |
| 2533 | db_finalize(&q); |
| 2534 | if( nChng>0 ){ |
| 2535 | int nrid; |
| 2536 | Blob cksum; |
| 2537 | blob_appendf(ctrl, "U %F\n", login_name()); |
| 2538 | md5sum_blob(ctrl, &cksum); |
| 2539 | blob_appendf(ctrl, "Z %b\n", &cksum); |
| 2540 | db_begin_transaction(); |
| 2541 | g.markPrivate = content_is_private(rid); |
| 2542 | nrid = content_put(ctrl); |
| 2543 | manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS); |
| 2544 | assert( blob_is_reset(ctrl) ); |
| 2545 | db_end_transaction(0); |
| 2546 | } |
| 2547 | } |
| 2548 | |
| 2549 | /* |
| 2550 | ** This method checks that the date can be parsed. |
| @@ -2680,11 +2696,11 @@ | |
| 2680 | db_finalize(&q); |
| 2681 | if( zHideFlag[0] ) hide_branch(); |
| 2682 | if( zCloseFlag[0] ) close_leaf(rid); |
| 2683 | if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag); |
| 2684 | if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 2685 | apply_newtags(&ctrl, rid, zUuid); |
| 2686 | cgi_redirectf("%R/ci/%S", zUuid); |
| 2687 | } |
| 2688 | blob_zero(&comment); |
| 2689 | blob_append(&comment, zNewComment, -1); |
| 2690 | zUuid[10] = 0; |
| @@ -2934,10 +2950,13 @@ | |
| 2934 | ** --tag TAG Add new TAG to this check-in |
| 2935 | ** --cancel TAG Cancel TAG from this check-in |
| 2936 | ** --branch NAME Make this check-in the start of branch NAME |
| 2937 | ** --hide Hide branch starting from this check-in |
| 2938 | ** --close Mark this "leaf" as closed |
| 2939 | ** |
| 2940 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 2941 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 2942 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 2943 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| @@ -2963,11 +2982,13 @@ | |
| 2963 | int fPropagateColor; /* True if color propagates before amend */ |
| 2964 | int fNewPropagateColor = 0; /* True if color propagates after amend */ |
| 2965 | int fHasHidden = 0; /* True if hidden tag already set */ |
| 2966 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2967 | int fEditComment; /* True if editor to be used for comment */ |
| 2968 | const char *zChngTime; /* The change time on the control artifact */ |
| 2969 | const char *zUuid; |
| 2970 | Blob ctrl; |
| 2971 | Blob comment; |
| 2972 | char *zNow; |
| 2973 | int nTags, nCancels; |
| @@ -2989,11 +3010,15 @@ | |
| 2989 | zNewUser = find_option("author",0,1); |
| 2990 | pzNewTags = find_repeatable_option("tag",0,&nTags); |
| 2991 | pzCancelTags = find_repeatable_option("cancel",0,&nCancels); |
| 2992 | fClose = find_option("close",0,0)!=0; |
| 2993 | fHide = find_option("hide",0,0)!=0; |
| 2994 | zChngTime = find_option("chngtime",0,1); |
| 2995 | db_find_and_open_repository(0,0); |
| 2996 | user_select(); |
| 2997 | verify_all_options(); |
| 2998 | if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT); |
| 2999 | rid = name_to_typed_rid(g.argv[2], "ci"); |
| @@ -3085,8 +3110,10 @@ | |
| 3085 | fossil_free((void *)pzCancelTags); |
| 3086 | } |
| 3087 | if( fHide && !fHasHidden ) hide_branch(); |
| 3088 | if( fClose && !fHasClosed ) close_leaf(rid); |
| 3089 | if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 3090 | apply_newtags(&ctrl, rid, zUuid); |
| 3091 | show_common_info(rid, "uuid:", 1, 0); |
| 3092 | } |
| 3093 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2511,11 +2511,17 @@ | |
| 2511 | |
| 2512 | /* |
| 2513 | ** The apply_newtags method is called after all newtags have been added |
| 2514 | ** and the control artifact is completed and then written to the DB. |
| 2515 | */ |
| 2516 | static void apply_newtags( |
| 2517 | Blob *ctrl, |
| 2518 | int rid, |
| 2519 | const char *zUuid, |
| 2520 | const char *zUserOvrd, /* The user name on the control artifact */ |
| 2521 | int fDryRun /* Print control artifact, but make no changes */ |
| 2522 | ){ |
| 2523 | Stmt q; |
| 2524 | int nChng = 0; |
| 2525 | |
| 2526 | db_prepare(&q, "SELECT tag, prefix, value FROM newtags" |
| 2527 | " ORDER BY prefix || tag"); |
| @@ -2532,19 +2538,29 @@ | |
| 2538 | } |
| 2539 | db_finalize(&q); |
| 2540 | if( nChng>0 ){ |
| 2541 | int nrid; |
| 2542 | Blob cksum; |
| 2543 | if( zUserOvrd && zUserOvrd[0] ){ |
| 2544 | blob_appendf(ctrl, "U %F\n", zUserOvrd); |
| 2545 | }else{ |
| 2546 | blob_appendf(ctrl, "U %F\n", login_name()); |
| 2547 | } |
| 2548 | md5sum_blob(ctrl, &cksum); |
| 2549 | blob_appendf(ctrl, "Z %b\n", &cksum); |
| 2550 | if( fDryRun ){ |
| 2551 | assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */ |
| 2552 | fossil_print("%s", blob_str(ctrl)); |
| 2553 | blob_reset(ctrl); |
| 2554 | }else{ |
| 2555 | db_begin_transaction(); |
| 2556 | g.markPrivate = content_is_private(rid); |
| 2557 | nrid = content_put(ctrl); |
| 2558 | manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS); |
| 2559 | db_end_transaction(0); |
| 2560 | } |
| 2561 | assert( blob_is_reset(ctrl) ); |
| 2562 | } |
| 2563 | } |
| 2564 | |
| 2565 | /* |
| 2566 | ** This method checks that the date can be parsed. |
| @@ -2680,11 +2696,11 @@ | |
| 2696 | db_finalize(&q); |
| 2697 | if( zHideFlag[0] ) hide_branch(); |
| 2698 | if( zCloseFlag[0] ) close_leaf(rid); |
| 2699 | if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag); |
| 2700 | if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 2701 | apply_newtags(&ctrl, rid, zUuid, 0, 0); |
| 2702 | cgi_redirectf("%R/ci/%S", zUuid); |
| 2703 | } |
| 2704 | blob_zero(&comment); |
| 2705 | blob_append(&comment, zNewComment, -1); |
| 2706 | zUuid[10] = 0; |
| @@ -2934,10 +2950,13 @@ | |
| 2950 | ** --tag TAG Add new TAG to this check-in |
| 2951 | ** --cancel TAG Cancel TAG from this check-in |
| 2952 | ** --branch NAME Make this check-in the start of branch NAME |
| 2953 | ** --hide Hide branch starting from this check-in |
| 2954 | ** --close Mark this "leaf" as closed |
| 2955 | ** -n|--dry-run Print control artifact, but make no changes |
| 2956 | ** --date-override DATETIME Set the change time on the control artifact |
| 2957 | ** --user-override USER Set the user name on the control artifact |
| 2958 | ** |
| 2959 | ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in |
| 2960 | ** year-month-day form, it may be truncated, the "T" may be replaced by |
| 2961 | ** a space, and it may also name a timezone offset from UTC as "-HH:MM" |
| 2962 | ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" |
| @@ -2963,11 +2982,13 @@ | |
| 2982 | int fPropagateColor; /* True if color propagates before amend */ |
| 2983 | int fNewPropagateColor = 0; /* True if color propagates after amend */ |
| 2984 | int fHasHidden = 0; /* True if hidden tag already set */ |
| 2985 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2986 | int fEditComment; /* True if editor to be used for comment */ |
| 2987 | int fDryRun; /* Print control artifact, make no changes */ |
| 2988 | const char *zChngTime; /* The change time on the control artifact */ |
| 2989 | const char *zUserOvrd; /* The user name on the control artifact */ |
| 2990 | const char *zUuid; |
| 2991 | Blob ctrl; |
| 2992 | Blob comment; |
| 2993 | char *zNow; |
| 2994 | int nTags, nCancels; |
| @@ -2989,11 +3010,15 @@ | |
| 3010 | zNewUser = find_option("author",0,1); |
| 3011 | pzNewTags = find_repeatable_option("tag",0,&nTags); |
| 3012 | pzCancelTags = find_repeatable_option("cancel",0,&nCancels); |
| 3013 | fClose = find_option("close",0,0)!=0; |
| 3014 | fHide = find_option("hide",0,0)!=0; |
| 3015 | fDryRun = find_option("dry-run","n",0)!=0; |
| 3016 | if( fDryRun==0 ) fDryRun = find_option("dryrun","n",0)!=0; |
| 3017 | zChngTime = find_option("date-override",0,1); |
| 3018 | if( zChngTime==0 ) zChngTime = find_option("chngtime",0,1); |
| 3019 | zUserOvrd = find_option("user-override",0,1); |
| 3020 | db_find_and_open_repository(0,0); |
| 3021 | user_select(); |
| 3022 | verify_all_options(); |
| 3023 | if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT); |
| 3024 | rid = name_to_typed_rid(g.argv[2], "ci"); |
| @@ -3085,8 +3110,10 @@ | |
| 3110 | fossil_free((void *)pzCancelTags); |
| 3111 | } |
| 3112 | if( fHide && !fHasHidden ) hide_branch(); |
| 3113 | if( fClose && !fHasClosed ) close_leaf(rid); |
| 3114 | if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch); |
| 3115 | apply_newtags(&ctrl, rid, zUuid, zUserOvrd, fDryRun); |
| 3116 | if( fDryRun==0 ){ |
| 3117 | show_common_info(rid, "uuid:", 1, 0); |
| 3118 | } |
| 3119 | } |
| 3120 |
+28
-7
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -394,10 +394,17 @@ | ||
| 394 | 394 | ** |
| 395 | 395 | ** Remove the tag TAGNAME from CHECK-IN, and also remove |
| 396 | 396 | ** the propagation of the tag to any descendants. Use the |
| 397 | 397 | ** the --dryrun or -n options to see what would have happened. |
| 398 | 398 | ** |
| 399 | +** Options: | |
| 400 | +** --raw Raw tag name. | |
| 401 | +** --date-override DATETIME Set date and time deleted. | |
| 402 | +** --user-override USER Name USER when deleting the tag. | |
| 403 | +** --dryrun|-n Display the control artifact, but do | |
| 404 | +** not insert it into the database. | |
| 405 | +** | |
| 399 | 406 | ** %fossil tag find ?OPTIONS? TAGNAME |
| 400 | 407 | ** |
| 401 | 408 | ** List all objects that use TAGNAME. TYPE can be "ci" for |
| 402 | 409 | ** check-ins or "e" for events. The limit option limits the number |
| 403 | 410 | ** of results to the given value. |
| @@ -432,15 +439,10 @@ | ||
| 432 | 439 | ** will assume that "decaf" is a tag/branch name. |
| 433 | 440 | ** |
| 434 | 441 | */ |
| 435 | 442 | void tag_cmd(void){ |
| 436 | 443 | int n; |
| 437 | - int fRaw = find_option("raw","",0)!=0; | |
| 438 | - int fPropagate = find_option("propagate","",0)!=0; | |
| 439 | - const char *zPrefix = fRaw ? "" : "sym-"; | |
| 440 | - const char *zFindLimit = find_option("limit","n",1); | |
| 441 | - const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; | |
| 442 | 444 | |
| 443 | 445 | db_find_and_open_repository(0, 0); |
| 444 | 446 | if( g.argc<3 ){ |
| 445 | 447 | goto tag_cmd_usage; |
| 446 | 448 | } |
| @@ -450,10 +452,13 @@ | ||
| 450 | 452 | } |
| 451 | 453 | |
| 452 | 454 | if( strncmp(g.argv[2],"add",n)==0 ){ |
| 453 | 455 | char *zValue; |
| 454 | 456 | int dryRun = 0; |
| 457 | + int fRaw = find_option("raw","",0)!=0; | |
| 458 | + const char *zPrefix = fRaw ? "" : "sym-"; | |
| 459 | + int fPropagate = find_option("propagate","",0)!=0; | |
| 455 | 460 | const char *zDateOvrd = find_option("date-override",0,1); |
| 456 | 461 | const char *zUserOvrd = find_option("user-override",0,1); |
| 457 | 462 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 458 | 463 | if( g.argc!=5 && g.argc!=6 ){ |
| 459 | 464 | usage("add ?options? TAGNAME CHECK-IN ?VALUE?"); |
| @@ -470,21 +475,29 @@ | ||
| 470 | 475 | "Use the \"fossil branch new\" command instead."); |
| 471 | 476 | }else |
| 472 | 477 | |
| 473 | 478 | if( strncmp(g.argv[2],"cancel",n)==0 ){ |
| 474 | 479 | int dryRun = 0; |
| 480 | + int fRaw = find_option("raw","",0)!=0; | |
| 481 | + const char *zPrefix = fRaw ? "" : "sym-"; | |
| 482 | + const char *zDateOvrd = find_option("date-override",0,1); | |
| 483 | + const char *zUserOvrd = find_option("user-override",0,1); | |
| 475 | 484 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 476 | 485 | if( g.argc!=5 ){ |
| 477 | 486 | usage("cancel ?options? TAGNAME CHECK-IN"); |
| 478 | 487 | } |
| 479 | 488 | db_begin_transaction(); |
| 480 | - tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, 0, 0); | |
| 489 | + tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, | |
| 490 | + zDateOvrd, zUserOvrd); | |
| 481 | 491 | db_end_transaction(0); |
| 482 | 492 | }else |
| 483 | 493 | |
| 484 | 494 | if( strncmp(g.argv[2],"find",n)==0 ){ |
| 485 | 495 | Stmt q; |
| 496 | + int fRaw = find_option("raw","",0)!=0; | |
| 497 | + const char *zFindLimit = find_option("limit","n",1); | |
| 498 | + const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; | |
| 486 | 499 | const char *zType = find_option("type","t",1); |
| 487 | 500 | Blob sql = empty_blob; |
| 488 | 501 | if( zType==0 || zType[0]==0 ) zType = "*"; |
| 489 | 502 | if( g.argc!=4 ){ |
| 490 | 503 | usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME"); |
| @@ -528,10 +541,11 @@ | ||
| 528 | 541 | } |
| 529 | 542 | }else |
| 530 | 543 | |
| 531 | 544 | if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ |
| 532 | 545 | Stmt q; |
| 546 | + int fRaw = find_option("raw","",0)!=0; | |
| 533 | 547 | if( g.argc==3 ){ |
| 534 | 548 | db_prepare(&q, |
| 535 | 549 | "SELECT tagname FROM tag" |
| 536 | 550 | " WHERE EXISTS(SELECT 1 FROM tagxref" |
| 537 | 551 | " WHERE tagid=tag.tagid" |
| @@ -606,20 +620,26 @@ | ||
| 606 | 620 | ** --test Make database entries but do not add the tag artifact. |
| 607 | 621 | ** So the reparent operation will be undone by the next |
| 608 | 622 | ** "fossil rebuild" command. |
| 609 | 623 | ** --dryrun | -n Print the tag that would have been created but do not |
| 610 | 624 | ** actually change the database in any way. |
| 625 | +** --date-override DATETIME Set the change time on the control artifact | |
| 626 | +** --user-override USER Set the user name on the control artifact | |
| 611 | 627 | */ |
| 612 | 628 | void reparent_cmd(void){ |
| 613 | 629 | int bTest = find_option("test","",0)!=0; |
| 614 | 630 | int rid; |
| 615 | 631 | int i; |
| 616 | 632 | Blob value; |
| 617 | 633 | char *zUuid; |
| 618 | 634 | int dryRun = 0; |
| 635 | + const char *zDateOvrd; /* The change time on the control artifact */ | |
| 636 | + const char *zUserOvrd; /* The user name on the control artifact */ | |
| 619 | 637 | |
| 620 | 638 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 639 | + zDateOvrd = find_option("date-override",0,1); | |
| 640 | + zUserOvrd = find_option("user-override",0,1); | |
| 621 | 641 | db_find_and_open_repository(0, 0); |
| 622 | 642 | verify_all_options(); |
| 623 | 643 | if( g.argc<4 ){ |
| 624 | 644 | usage("[OPTIONS] CHECK-IN PARENT ..."); |
| 625 | 645 | } |
| @@ -634,11 +654,12 @@ | ||
| 634 | 654 | } |
| 635 | 655 | if( bTest && !dryRun ){ |
| 636 | 656 | tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid); |
| 637 | 657 | }else{ |
| 638 | 658 | zUuid = rid_to_uuid(rid); |
| 639 | - tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0); | |
| 659 | + tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun, | |
| 660 | + zDateOvrd,zUserOvrd); | |
| 640 | 661 | } |
| 641 | 662 | } |
| 642 | 663 | |
| 643 | 664 | |
| 644 | 665 | /* |
| 645 | 666 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -394,10 +394,17 @@ | |
| 394 | ** |
| 395 | ** Remove the tag TAGNAME from CHECK-IN, and also remove |
| 396 | ** the propagation of the tag to any descendants. Use the |
| 397 | ** the --dryrun or -n options to see what would have happened. |
| 398 | ** |
| 399 | ** %fossil tag find ?OPTIONS? TAGNAME |
| 400 | ** |
| 401 | ** List all objects that use TAGNAME. TYPE can be "ci" for |
| 402 | ** check-ins or "e" for events. The limit option limits the number |
| 403 | ** of results to the given value. |
| @@ -432,15 +439,10 @@ | |
| 432 | ** will assume that "decaf" is a tag/branch name. |
| 433 | ** |
| 434 | */ |
| 435 | void tag_cmd(void){ |
| 436 | int n; |
| 437 | int fRaw = find_option("raw","",0)!=0; |
| 438 | int fPropagate = find_option("propagate","",0)!=0; |
| 439 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 440 | const char *zFindLimit = find_option("limit","n",1); |
| 441 | const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; |
| 442 | |
| 443 | db_find_and_open_repository(0, 0); |
| 444 | if( g.argc<3 ){ |
| 445 | goto tag_cmd_usage; |
| 446 | } |
| @@ -450,10 +452,13 @@ | |
| 450 | } |
| 451 | |
| 452 | if( strncmp(g.argv[2],"add",n)==0 ){ |
| 453 | char *zValue; |
| 454 | int dryRun = 0; |
| 455 | const char *zDateOvrd = find_option("date-override",0,1); |
| 456 | const char *zUserOvrd = find_option("user-override",0,1); |
| 457 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 458 | if( g.argc!=5 && g.argc!=6 ){ |
| 459 | usage("add ?options? TAGNAME CHECK-IN ?VALUE?"); |
| @@ -470,21 +475,29 @@ | |
| 470 | "Use the \"fossil branch new\" command instead."); |
| 471 | }else |
| 472 | |
| 473 | if( strncmp(g.argv[2],"cancel",n)==0 ){ |
| 474 | int dryRun = 0; |
| 475 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 476 | if( g.argc!=5 ){ |
| 477 | usage("cancel ?options? TAGNAME CHECK-IN"); |
| 478 | } |
| 479 | db_begin_transaction(); |
| 480 | tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, 0, 0); |
| 481 | db_end_transaction(0); |
| 482 | }else |
| 483 | |
| 484 | if( strncmp(g.argv[2],"find",n)==0 ){ |
| 485 | Stmt q; |
| 486 | const char *zType = find_option("type","t",1); |
| 487 | Blob sql = empty_blob; |
| 488 | if( zType==0 || zType[0]==0 ) zType = "*"; |
| 489 | if( g.argc!=4 ){ |
| 490 | usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME"); |
| @@ -528,10 +541,11 @@ | |
| 528 | } |
| 529 | }else |
| 530 | |
| 531 | if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ |
| 532 | Stmt q; |
| 533 | if( g.argc==3 ){ |
| 534 | db_prepare(&q, |
| 535 | "SELECT tagname FROM tag" |
| 536 | " WHERE EXISTS(SELECT 1 FROM tagxref" |
| 537 | " WHERE tagid=tag.tagid" |
| @@ -606,20 +620,26 @@ | |
| 606 | ** --test Make database entries but do not add the tag artifact. |
| 607 | ** So the reparent operation will be undone by the next |
| 608 | ** "fossil rebuild" command. |
| 609 | ** --dryrun | -n Print the tag that would have been created but do not |
| 610 | ** actually change the database in any way. |
| 611 | */ |
| 612 | void reparent_cmd(void){ |
| 613 | int bTest = find_option("test","",0)!=0; |
| 614 | int rid; |
| 615 | int i; |
| 616 | Blob value; |
| 617 | char *zUuid; |
| 618 | int dryRun = 0; |
| 619 | |
| 620 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 621 | db_find_and_open_repository(0, 0); |
| 622 | verify_all_options(); |
| 623 | if( g.argc<4 ){ |
| 624 | usage("[OPTIONS] CHECK-IN PARENT ..."); |
| 625 | } |
| @@ -634,11 +654,12 @@ | |
| 634 | } |
| 635 | if( bTest && !dryRun ){ |
| 636 | tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid); |
| 637 | }else{ |
| 638 | zUuid = rid_to_uuid(rid); |
| 639 | tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0); |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | |
| 644 | /* |
| 645 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -394,10 +394,17 @@ | |
| 394 | ** |
| 395 | ** Remove the tag TAGNAME from CHECK-IN, and also remove |
| 396 | ** the propagation of the tag to any descendants. Use the |
| 397 | ** the --dryrun or -n options to see what would have happened. |
| 398 | ** |
| 399 | ** Options: |
| 400 | ** --raw Raw tag name. |
| 401 | ** --date-override DATETIME Set date and time deleted. |
| 402 | ** --user-override USER Name USER when deleting the tag. |
| 403 | ** --dryrun|-n Display the control artifact, but do |
| 404 | ** not insert it into the database. |
| 405 | ** |
| 406 | ** %fossil tag find ?OPTIONS? TAGNAME |
| 407 | ** |
| 408 | ** List all objects that use TAGNAME. TYPE can be "ci" for |
| 409 | ** check-ins or "e" for events. The limit option limits the number |
| 410 | ** of results to the given value. |
| @@ -432,15 +439,10 @@ | |
| 439 | ** will assume that "decaf" is a tag/branch name. |
| 440 | ** |
| 441 | */ |
| 442 | void tag_cmd(void){ |
| 443 | int n; |
| 444 | |
| 445 | db_find_and_open_repository(0, 0); |
| 446 | if( g.argc<3 ){ |
| 447 | goto tag_cmd_usage; |
| 448 | } |
| @@ -450,10 +452,13 @@ | |
| 452 | } |
| 453 | |
| 454 | if( strncmp(g.argv[2],"add",n)==0 ){ |
| 455 | char *zValue; |
| 456 | int dryRun = 0; |
| 457 | int fRaw = find_option("raw","",0)!=0; |
| 458 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 459 | int fPropagate = find_option("propagate","",0)!=0; |
| 460 | const char *zDateOvrd = find_option("date-override",0,1); |
| 461 | const char *zUserOvrd = find_option("user-override",0,1); |
| 462 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 463 | if( g.argc!=5 && g.argc!=6 ){ |
| 464 | usage("add ?options? TAGNAME CHECK-IN ?VALUE?"); |
| @@ -470,21 +475,29 @@ | |
| 475 | "Use the \"fossil branch new\" command instead."); |
| 476 | }else |
| 477 | |
| 478 | if( strncmp(g.argv[2],"cancel",n)==0 ){ |
| 479 | int dryRun = 0; |
| 480 | int fRaw = find_option("raw","",0)!=0; |
| 481 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 482 | const char *zDateOvrd = find_option("date-override",0,1); |
| 483 | const char *zUserOvrd = find_option("user-override",0,1); |
| 484 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 485 | if( g.argc!=5 ){ |
| 486 | usage("cancel ?options? TAGNAME CHECK-IN"); |
| 487 | } |
| 488 | db_begin_transaction(); |
| 489 | tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, |
| 490 | zDateOvrd, zUserOvrd); |
| 491 | db_end_transaction(0); |
| 492 | }else |
| 493 | |
| 494 | if( strncmp(g.argv[2],"find",n)==0 ){ |
| 495 | Stmt q; |
| 496 | int fRaw = find_option("raw","",0)!=0; |
| 497 | const char *zFindLimit = find_option("limit","n",1); |
| 498 | const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; |
| 499 | const char *zType = find_option("type","t",1); |
| 500 | Blob sql = empty_blob; |
| 501 | if( zType==0 || zType[0]==0 ) zType = "*"; |
| 502 | if( g.argc!=4 ){ |
| 503 | usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME"); |
| @@ -528,10 +541,11 @@ | |
| 541 | } |
| 542 | }else |
| 543 | |
| 544 | if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ |
| 545 | Stmt q; |
| 546 | int fRaw = find_option("raw","",0)!=0; |
| 547 | if( g.argc==3 ){ |
| 548 | db_prepare(&q, |
| 549 | "SELECT tagname FROM tag" |
| 550 | " WHERE EXISTS(SELECT 1 FROM tagxref" |
| 551 | " WHERE tagid=tag.tagid" |
| @@ -606,20 +620,26 @@ | |
| 620 | ** --test Make database entries but do not add the tag artifact. |
| 621 | ** So the reparent operation will be undone by the next |
| 622 | ** "fossil rebuild" command. |
| 623 | ** --dryrun | -n Print the tag that would have been created but do not |
| 624 | ** actually change the database in any way. |
| 625 | ** --date-override DATETIME Set the change time on the control artifact |
| 626 | ** --user-override USER Set the user name on the control artifact |
| 627 | */ |
| 628 | void reparent_cmd(void){ |
| 629 | int bTest = find_option("test","",0)!=0; |
| 630 | int rid; |
| 631 | int i; |
| 632 | Blob value; |
| 633 | char *zUuid; |
| 634 | int dryRun = 0; |
| 635 | const char *zDateOvrd; /* The change time on the control artifact */ |
| 636 | const char *zUserOvrd; /* The user name on the control artifact */ |
| 637 | |
| 638 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 639 | zDateOvrd = find_option("date-override",0,1); |
| 640 | zUserOvrd = find_option("user-override",0,1); |
| 641 | db_find_and_open_repository(0, 0); |
| 642 | verify_all_options(); |
| 643 | if( g.argc<4 ){ |
| 644 | usage("[OPTIONS] CHECK-IN PARENT ..."); |
| 645 | } |
| @@ -634,11 +654,12 @@ | |
| 654 | } |
| 655 | if( bTest && !dryRun ){ |
| 656 | tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid); |
| 657 | }else{ |
| 658 | zUuid = rid_to_uuid(rid); |
| 659 | tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun, |
| 660 | zDateOvrd,zUserOvrd); |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | |
| 665 | /* |
| 666 |
+28
-7
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -394,10 +394,17 @@ | ||
| 394 | 394 | ** |
| 395 | 395 | ** Remove the tag TAGNAME from CHECK-IN, and also remove |
| 396 | 396 | ** the propagation of the tag to any descendants. Use the |
| 397 | 397 | ** the --dryrun or -n options to see what would have happened. |
| 398 | 398 | ** |
| 399 | +** Options: | |
| 400 | +** --raw Raw tag name. | |
| 401 | +** --date-override DATETIME Set date and time deleted. | |
| 402 | +** --user-override USER Name USER when deleting the tag. | |
| 403 | +** --dryrun|-n Display the control artifact, but do | |
| 404 | +** not insert it into the database. | |
| 405 | +** | |
| 399 | 406 | ** %fossil tag find ?OPTIONS? TAGNAME |
| 400 | 407 | ** |
| 401 | 408 | ** List all objects that use TAGNAME. TYPE can be "ci" for |
| 402 | 409 | ** check-ins or "e" for events. The limit option limits the number |
| 403 | 410 | ** of results to the given value. |
| @@ -432,15 +439,10 @@ | ||
| 432 | 439 | ** will assume that "decaf" is a tag/branch name. |
| 433 | 440 | ** |
| 434 | 441 | */ |
| 435 | 442 | void tag_cmd(void){ |
| 436 | 443 | int n; |
| 437 | - int fRaw = find_option("raw","",0)!=0; | |
| 438 | - int fPropagate = find_option("propagate","",0)!=0; | |
| 439 | - const char *zPrefix = fRaw ? "" : "sym-"; | |
| 440 | - const char *zFindLimit = find_option("limit","n",1); | |
| 441 | - const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; | |
| 442 | 444 | |
| 443 | 445 | db_find_and_open_repository(0, 0); |
| 444 | 446 | if( g.argc<3 ){ |
| 445 | 447 | goto tag_cmd_usage; |
| 446 | 448 | } |
| @@ -450,10 +452,13 @@ | ||
| 450 | 452 | } |
| 451 | 453 | |
| 452 | 454 | if( strncmp(g.argv[2],"add",n)==0 ){ |
| 453 | 455 | char *zValue; |
| 454 | 456 | int dryRun = 0; |
| 457 | + int fRaw = find_option("raw","",0)!=0; | |
| 458 | + const char *zPrefix = fRaw ? "" : "sym-"; | |
| 459 | + int fPropagate = find_option("propagate","",0)!=0; | |
| 455 | 460 | const char *zDateOvrd = find_option("date-override",0,1); |
| 456 | 461 | const char *zUserOvrd = find_option("user-override",0,1); |
| 457 | 462 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 458 | 463 | if( g.argc!=5 && g.argc!=6 ){ |
| 459 | 464 | usage("add ?options? TAGNAME CHECK-IN ?VALUE?"); |
| @@ -470,21 +475,29 @@ | ||
| 470 | 475 | "Use the \"fossil branch new\" command instead."); |
| 471 | 476 | }else |
| 472 | 477 | |
| 473 | 478 | if( strncmp(g.argv[2],"cancel",n)==0 ){ |
| 474 | 479 | int dryRun = 0; |
| 480 | + int fRaw = find_option("raw","",0)!=0; | |
| 481 | + const char *zPrefix = fRaw ? "" : "sym-"; | |
| 482 | + const char *zDateOvrd = find_option("date-override",0,1); | |
| 483 | + const char *zUserOvrd = find_option("user-override",0,1); | |
| 475 | 484 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 476 | 485 | if( g.argc!=5 ){ |
| 477 | 486 | usage("cancel ?options? TAGNAME CHECK-IN"); |
| 478 | 487 | } |
| 479 | 488 | db_begin_transaction(); |
| 480 | - tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, 0, 0); | |
| 489 | + tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, | |
| 490 | + zDateOvrd, zUserOvrd); | |
| 481 | 491 | db_end_transaction(0); |
| 482 | 492 | }else |
| 483 | 493 | |
| 484 | 494 | if( strncmp(g.argv[2],"find",n)==0 ){ |
| 485 | 495 | Stmt q; |
| 496 | + int fRaw = find_option("raw","",0)!=0; | |
| 497 | + const char *zFindLimit = find_option("limit","n",1); | |
| 498 | + const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; | |
| 486 | 499 | const char *zType = find_option("type","t",1); |
| 487 | 500 | Blob sql = empty_blob; |
| 488 | 501 | if( zType==0 || zType[0]==0 ) zType = "*"; |
| 489 | 502 | if( g.argc!=4 ){ |
| 490 | 503 | usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME"); |
| @@ -528,10 +541,11 @@ | ||
| 528 | 541 | } |
| 529 | 542 | }else |
| 530 | 543 | |
| 531 | 544 | if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ |
| 532 | 545 | Stmt q; |
| 546 | + int fRaw = find_option("raw","",0)!=0; | |
| 533 | 547 | if( g.argc==3 ){ |
| 534 | 548 | db_prepare(&q, |
| 535 | 549 | "SELECT tagname FROM tag" |
| 536 | 550 | " WHERE EXISTS(SELECT 1 FROM tagxref" |
| 537 | 551 | " WHERE tagid=tag.tagid" |
| @@ -606,20 +620,26 @@ | ||
| 606 | 620 | ** --test Make database entries but do not add the tag artifact. |
| 607 | 621 | ** So the reparent operation will be undone by the next |
| 608 | 622 | ** "fossil rebuild" command. |
| 609 | 623 | ** --dryrun | -n Print the tag that would have been created but do not |
| 610 | 624 | ** actually change the database in any way. |
| 625 | +** --date-override DATETIME Set the change time on the control artifact | |
| 626 | +** --user-override USER Set the user name on the control artifact | |
| 611 | 627 | */ |
| 612 | 628 | void reparent_cmd(void){ |
| 613 | 629 | int bTest = find_option("test","",0)!=0; |
| 614 | 630 | int rid; |
| 615 | 631 | int i; |
| 616 | 632 | Blob value; |
| 617 | 633 | char *zUuid; |
| 618 | 634 | int dryRun = 0; |
| 635 | + const char *zDateOvrd; /* The change time on the control artifact */ | |
| 636 | + const char *zUserOvrd; /* The user name on the control artifact */ | |
| 619 | 637 | |
| 620 | 638 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 639 | + zDateOvrd = find_option("date-override",0,1); | |
| 640 | + zUserOvrd = find_option("user-override",0,1); | |
| 621 | 641 | db_find_and_open_repository(0, 0); |
| 622 | 642 | verify_all_options(); |
| 623 | 643 | if( g.argc<4 ){ |
| 624 | 644 | usage("[OPTIONS] CHECK-IN PARENT ..."); |
| 625 | 645 | } |
| @@ -634,11 +654,12 @@ | ||
| 634 | 654 | } |
| 635 | 655 | if( bTest && !dryRun ){ |
| 636 | 656 | tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid); |
| 637 | 657 | }else{ |
| 638 | 658 | zUuid = rid_to_uuid(rid); |
| 639 | - tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0); | |
| 659 | + tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun, | |
| 660 | + zDateOvrd,zUserOvrd); | |
| 640 | 661 | } |
| 641 | 662 | } |
| 642 | 663 | |
| 643 | 664 | |
| 644 | 665 | /* |
| 645 | 666 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -394,10 +394,17 @@ | |
| 394 | ** |
| 395 | ** Remove the tag TAGNAME from CHECK-IN, and also remove |
| 396 | ** the propagation of the tag to any descendants. Use the |
| 397 | ** the --dryrun or -n options to see what would have happened. |
| 398 | ** |
| 399 | ** %fossil tag find ?OPTIONS? TAGNAME |
| 400 | ** |
| 401 | ** List all objects that use TAGNAME. TYPE can be "ci" for |
| 402 | ** check-ins or "e" for events. The limit option limits the number |
| 403 | ** of results to the given value. |
| @@ -432,15 +439,10 @@ | |
| 432 | ** will assume that "decaf" is a tag/branch name. |
| 433 | ** |
| 434 | */ |
| 435 | void tag_cmd(void){ |
| 436 | int n; |
| 437 | int fRaw = find_option("raw","",0)!=0; |
| 438 | int fPropagate = find_option("propagate","",0)!=0; |
| 439 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 440 | const char *zFindLimit = find_option("limit","n",1); |
| 441 | const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; |
| 442 | |
| 443 | db_find_and_open_repository(0, 0); |
| 444 | if( g.argc<3 ){ |
| 445 | goto tag_cmd_usage; |
| 446 | } |
| @@ -450,10 +452,13 @@ | |
| 450 | } |
| 451 | |
| 452 | if( strncmp(g.argv[2],"add",n)==0 ){ |
| 453 | char *zValue; |
| 454 | int dryRun = 0; |
| 455 | const char *zDateOvrd = find_option("date-override",0,1); |
| 456 | const char *zUserOvrd = find_option("user-override",0,1); |
| 457 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 458 | if( g.argc!=5 && g.argc!=6 ){ |
| 459 | usage("add ?options? TAGNAME CHECK-IN ?VALUE?"); |
| @@ -470,21 +475,29 @@ | |
| 470 | "Use the \"fossil branch new\" command instead."); |
| 471 | }else |
| 472 | |
| 473 | if( strncmp(g.argv[2],"cancel",n)==0 ){ |
| 474 | int dryRun = 0; |
| 475 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 476 | if( g.argc!=5 ){ |
| 477 | usage("cancel ?options? TAGNAME CHECK-IN"); |
| 478 | } |
| 479 | db_begin_transaction(); |
| 480 | tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, 0, 0); |
| 481 | db_end_transaction(0); |
| 482 | }else |
| 483 | |
| 484 | if( strncmp(g.argv[2],"find",n)==0 ){ |
| 485 | Stmt q; |
| 486 | const char *zType = find_option("type","t",1); |
| 487 | Blob sql = empty_blob; |
| 488 | if( zType==0 || zType[0]==0 ) zType = "*"; |
| 489 | if( g.argc!=4 ){ |
| 490 | usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME"); |
| @@ -528,10 +541,11 @@ | |
| 528 | } |
| 529 | }else |
| 530 | |
| 531 | if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ |
| 532 | Stmt q; |
| 533 | if( g.argc==3 ){ |
| 534 | db_prepare(&q, |
| 535 | "SELECT tagname FROM tag" |
| 536 | " WHERE EXISTS(SELECT 1 FROM tagxref" |
| 537 | " WHERE tagid=tag.tagid" |
| @@ -606,20 +620,26 @@ | |
| 606 | ** --test Make database entries but do not add the tag artifact. |
| 607 | ** So the reparent operation will be undone by the next |
| 608 | ** "fossil rebuild" command. |
| 609 | ** --dryrun | -n Print the tag that would have been created but do not |
| 610 | ** actually change the database in any way. |
| 611 | */ |
| 612 | void reparent_cmd(void){ |
| 613 | int bTest = find_option("test","",0)!=0; |
| 614 | int rid; |
| 615 | int i; |
| 616 | Blob value; |
| 617 | char *zUuid; |
| 618 | int dryRun = 0; |
| 619 | |
| 620 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 621 | db_find_and_open_repository(0, 0); |
| 622 | verify_all_options(); |
| 623 | if( g.argc<4 ){ |
| 624 | usage("[OPTIONS] CHECK-IN PARENT ..."); |
| 625 | } |
| @@ -634,11 +654,12 @@ | |
| 634 | } |
| 635 | if( bTest && !dryRun ){ |
| 636 | tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid); |
| 637 | }else{ |
| 638 | zUuid = rid_to_uuid(rid); |
| 639 | tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0); |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | |
| 644 | /* |
| 645 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -394,10 +394,17 @@ | |
| 394 | ** |
| 395 | ** Remove the tag TAGNAME from CHECK-IN, and also remove |
| 396 | ** the propagation of the tag to any descendants. Use the |
| 397 | ** the --dryrun or -n options to see what would have happened. |
| 398 | ** |
| 399 | ** Options: |
| 400 | ** --raw Raw tag name. |
| 401 | ** --date-override DATETIME Set date and time deleted. |
| 402 | ** --user-override USER Name USER when deleting the tag. |
| 403 | ** --dryrun|-n Display the control artifact, but do |
| 404 | ** not insert it into the database. |
| 405 | ** |
| 406 | ** %fossil tag find ?OPTIONS? TAGNAME |
| 407 | ** |
| 408 | ** List all objects that use TAGNAME. TYPE can be "ci" for |
| 409 | ** check-ins or "e" for events. The limit option limits the number |
| 410 | ** of results to the given value. |
| @@ -432,15 +439,10 @@ | |
| 439 | ** will assume that "decaf" is a tag/branch name. |
| 440 | ** |
| 441 | */ |
| 442 | void tag_cmd(void){ |
| 443 | int n; |
| 444 | |
| 445 | db_find_and_open_repository(0, 0); |
| 446 | if( g.argc<3 ){ |
| 447 | goto tag_cmd_usage; |
| 448 | } |
| @@ -450,10 +452,13 @@ | |
| 452 | } |
| 453 | |
| 454 | if( strncmp(g.argv[2],"add",n)==0 ){ |
| 455 | char *zValue; |
| 456 | int dryRun = 0; |
| 457 | int fRaw = find_option("raw","",0)!=0; |
| 458 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 459 | int fPropagate = find_option("propagate","",0)!=0; |
| 460 | const char *zDateOvrd = find_option("date-override",0,1); |
| 461 | const char *zUserOvrd = find_option("user-override",0,1); |
| 462 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 463 | if( g.argc!=5 && g.argc!=6 ){ |
| 464 | usage("add ?options? TAGNAME CHECK-IN ?VALUE?"); |
| @@ -470,21 +475,29 @@ | |
| 475 | "Use the \"fossil branch new\" command instead."); |
| 476 | }else |
| 477 | |
| 478 | if( strncmp(g.argv[2],"cancel",n)==0 ){ |
| 479 | int dryRun = 0; |
| 480 | int fRaw = find_option("raw","",0)!=0; |
| 481 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 482 | const char *zDateOvrd = find_option("date-override",0,1); |
| 483 | const char *zUserOvrd = find_option("user-override",0,1); |
| 484 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 485 | if( g.argc!=5 ){ |
| 486 | usage("cancel ?options? TAGNAME CHECK-IN"); |
| 487 | } |
| 488 | db_begin_transaction(); |
| 489 | tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, |
| 490 | zDateOvrd, zUserOvrd); |
| 491 | db_end_transaction(0); |
| 492 | }else |
| 493 | |
| 494 | if( strncmp(g.argv[2],"find",n)==0 ){ |
| 495 | Stmt q; |
| 496 | int fRaw = find_option("raw","",0)!=0; |
| 497 | const char *zFindLimit = find_option("limit","n",1); |
| 498 | const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; |
| 499 | const char *zType = find_option("type","t",1); |
| 500 | Blob sql = empty_blob; |
| 501 | if( zType==0 || zType[0]==0 ) zType = "*"; |
| 502 | if( g.argc!=4 ){ |
| 503 | usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME"); |
| @@ -528,10 +541,11 @@ | |
| 541 | } |
| 542 | }else |
| 543 | |
| 544 | if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ |
| 545 | Stmt q; |
| 546 | int fRaw = find_option("raw","",0)!=0; |
| 547 | if( g.argc==3 ){ |
| 548 | db_prepare(&q, |
| 549 | "SELECT tagname FROM tag" |
| 550 | " WHERE EXISTS(SELECT 1 FROM tagxref" |
| 551 | " WHERE tagid=tag.tagid" |
| @@ -606,20 +620,26 @@ | |
| 620 | ** --test Make database entries but do not add the tag artifact. |
| 621 | ** So the reparent operation will be undone by the next |
| 622 | ** "fossil rebuild" command. |
| 623 | ** --dryrun | -n Print the tag that would have been created but do not |
| 624 | ** actually change the database in any way. |
| 625 | ** --date-override DATETIME Set the change time on the control artifact |
| 626 | ** --user-override USER Set the user name on the control artifact |
| 627 | */ |
| 628 | void reparent_cmd(void){ |
| 629 | int bTest = find_option("test","",0)!=0; |
| 630 | int rid; |
| 631 | int i; |
| 632 | Blob value; |
| 633 | char *zUuid; |
| 634 | int dryRun = 0; |
| 635 | const char *zDateOvrd; /* The change time on the control artifact */ |
| 636 | const char *zUserOvrd; /* The user name on the control artifact */ |
| 637 | |
| 638 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 639 | zDateOvrd = find_option("date-override",0,1); |
| 640 | zUserOvrd = find_option("user-override",0,1); |
| 641 | db_find_and_open_repository(0, 0); |
| 642 | verify_all_options(); |
| 643 | if( g.argc<4 ){ |
| 644 | usage("[OPTIONS] CHECK-IN PARENT ..."); |
| 645 | } |
| @@ -634,11 +654,12 @@ | |
| 654 | } |
| 655 | if( bTest && !dryRun ){ |
| 656 | tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid); |
| 657 | }else{ |
| 658 | zUuid = rid_to_uuid(rid); |
| 659 | tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun, |
| 660 | zDateOvrd,zUserOvrd); |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | |
| 665 | /* |
| 666 |