Fossil SCM

General enhancements to the "amend", "tag", and "reparent" command, including adding flags like --override-date, --override-user, and --dry-run.

drh 2018-12-27 20:41 trunk merge
Commit 5c9955710fc68466e3818f768fc8bebb18ccc4706a5a0395f84052df7fa0208d
4 files changed +38 -11 +38 -11 +28 -7 +28 -7
+38 -11
--- src/info.c
+++ src/info.c
@@ -2511,11 +2511,17 @@
25112511
25122512
/*
25132513
** The apply_newtags method is called after all newtags have been added
25142514
** and the control artifact is completed and then written to the DB.
25152515
*/
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
+){
25172523
Stmt q;
25182524
int nChng = 0;
25192525
25202526
db_prepare(&q, "SELECT tag, prefix, value FROM newtags"
25212527
" ORDER BY prefix || tag");
@@ -2532,19 +2538,29 @@
25322538
}
25332539
db_finalize(&q);
25342540
if( nChng>0 ){
25352541
int nrid;
25362542
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
+ }
25382548
md5sum_blob(ctrl, &cksum);
25392549
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
+ }
25442561
assert( blob_is_reset(ctrl) );
2545
- db_end_transaction(0);
25462562
}
25472563
}
25482564
25492565
/*
25502566
** This method checks that the date can be parsed.
@@ -2680,11 +2696,11 @@
26802696
db_finalize(&q);
26812697
if( zHideFlag[0] ) hide_branch();
26822698
if( zCloseFlag[0] ) close_leaf(rid);
26832699
if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag);
26842700
if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch);
2685
- apply_newtags(&ctrl, rid, zUuid);
2701
+ apply_newtags(&ctrl, rid, zUuid, 0, 0);
26862702
cgi_redirectf("%R/ci/%S", zUuid);
26872703
}
26882704
blob_zero(&comment);
26892705
blob_append(&comment, zNewComment, -1);
26902706
zUuid[10] = 0;
@@ -2934,10 +2950,13 @@
29342950
** --tag TAG Add new TAG to this check-in
29352951
** --cancel TAG Cancel TAG from this check-in
29362952
** --branch NAME Make this check-in the start of branch NAME
29372953
** --hide Hide branch starting from this check-in
29382954
** --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
29392958
**
29402959
** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
29412960
** year-month-day form, it may be truncated, the "T" may be replaced by
29422961
** a space, and it may also name a timezone offset from UTC as "-HH:MM"
29432962
** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -2963,11 +2982,13 @@
29632982
int fPropagateColor; /* True if color propagates before amend */
29642983
int fNewPropagateColor = 0; /* True if color propagates after amend */
29652984
int fHasHidden = 0; /* True if hidden tag already set */
29662985
int fHasClosed = 0; /* True if closed tag already set */
29672986
int fEditComment; /* True if editor to be used for comment */
2987
+ int fDryRun; /* Print control artifact, make no changes */
29682988
const char *zChngTime; /* The change time on the control artifact */
2989
+ const char *zUserOvrd; /* The user name on the control artifact */
29692990
const char *zUuid;
29702991
Blob ctrl;
29712992
Blob comment;
29722993
char *zNow;
29732994
int nTags, nCancels;
@@ -2989,11 +3010,15 @@
29893010
zNewUser = find_option("author",0,1);
29903011
pzNewTags = find_repeatable_option("tag",0,&nTags);
29913012
pzCancelTags = find_repeatable_option("cancel",0,&nCancels);
29923013
fClose = find_option("close",0,0)!=0;
29933014
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);
29953020
db_find_and_open_repository(0,0);
29963021
user_select();
29973022
verify_all_options();
29983023
if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT);
29993024
rid = name_to_typed_rid(g.argv[2], "ci");
@@ -3085,8 +3110,10 @@
30853110
fossil_free((void *)pzCancelTags);
30863111
}
30873112
if( fHide && !fHasHidden ) hide_branch();
30883113
if( fClose && !fHasClosed ) close_leaf(rid);
30893114
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
+ }
30923119
}
30933120
--- 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 @@
25112511
25122512
/*
25132513
** The apply_newtags method is called after all newtags have been added
25142514
** and the control artifact is completed and then written to the DB.
25152515
*/
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
+){
25172523
Stmt q;
25182524
int nChng = 0;
25192525
25202526
db_prepare(&q, "SELECT tag, prefix, value FROM newtags"
25212527
" ORDER BY prefix || tag");
@@ -2532,19 +2538,29 @@
25322538
}
25332539
db_finalize(&q);
25342540
if( nChng>0 ){
25352541
int nrid;
25362542
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
+ }
25382548
md5sum_blob(ctrl, &cksum);
25392549
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
+ }
25442561
assert( blob_is_reset(ctrl) );
2545
- db_end_transaction(0);
25462562
}
25472563
}
25482564
25492565
/*
25502566
** This method checks that the date can be parsed.
@@ -2680,11 +2696,11 @@
26802696
db_finalize(&q);
26812697
if( zHideFlag[0] ) hide_branch();
26822698
if( zCloseFlag[0] ) close_leaf(rid);
26832699
if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag);
26842700
if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch);
2685
- apply_newtags(&ctrl, rid, zUuid);
2701
+ apply_newtags(&ctrl, rid, zUuid, 0, 0);
26862702
cgi_redirectf("%R/ci/%S", zUuid);
26872703
}
26882704
blob_zero(&comment);
26892705
blob_append(&comment, zNewComment, -1);
26902706
zUuid[10] = 0;
@@ -2934,10 +2950,13 @@
29342950
** --tag TAG Add new TAG to this check-in
29352951
** --cancel TAG Cancel TAG from this check-in
29362952
** --branch NAME Make this check-in the start of branch NAME
29372953
** --hide Hide branch starting from this check-in
29382954
** --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
29392958
**
29402959
** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
29412960
** year-month-day form, it may be truncated, the "T" may be replaced by
29422961
** a space, and it may also name a timezone offset from UTC as "-HH:MM"
29432962
** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -2963,11 +2982,13 @@
29632982
int fPropagateColor; /* True if color propagates before amend */
29642983
int fNewPropagateColor = 0; /* True if color propagates after amend */
29652984
int fHasHidden = 0; /* True if hidden tag already set */
29662985
int fHasClosed = 0; /* True if closed tag already set */
29672986
int fEditComment; /* True if editor to be used for comment */
2987
+ int fDryRun; /* Print control artifact, make no changes */
29682988
const char *zChngTime; /* The change time on the control artifact */
2989
+ const char *zUserOvrd; /* The user name on the control artifact */
29692990
const char *zUuid;
29702991
Blob ctrl;
29712992
Blob comment;
29722993
char *zNow;
29732994
int nTags, nCancels;
@@ -2989,11 +3010,15 @@
29893010
zNewUser = find_option("author",0,1);
29903011
pzNewTags = find_repeatable_option("tag",0,&nTags);
29913012
pzCancelTags = find_repeatable_option("cancel",0,&nCancels);
29923013
fClose = find_option("close",0,0)!=0;
29933014
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);
29953020
db_find_and_open_repository(0,0);
29963021
user_select();
29973022
verify_all_options();
29983023
if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT);
29993024
rid = name_to_typed_rid(g.argv[2], "ci");
@@ -3085,8 +3110,10 @@
30853110
fossil_free((void *)pzCancelTags);
30863111
}
30873112
if( fHide && !fHasHidden ) hide_branch();
30883113
if( fClose && !fHasClosed ) close_leaf(rid);
30893114
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
+ }
30923119
}
30933120
--- 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 @@
394394
**
395395
** Remove the tag TAGNAME from CHECK-IN, and also remove
396396
** the propagation of the tag to any descendants. Use the
397397
** the --dryrun or -n options to see what would have happened.
398398
**
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
+**
399406
** %fossil tag find ?OPTIONS? TAGNAME
400407
**
401408
** List all objects that use TAGNAME. TYPE can be "ci" for
402409
** check-ins or "e" for events. The limit option limits the number
403410
** of results to the given value.
@@ -432,15 +439,10 @@
432439
** will assume that "decaf" is a tag/branch name.
433440
**
434441
*/
435442
void tag_cmd(void){
436443
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;
442444
443445
db_find_and_open_repository(0, 0);
444446
if( g.argc<3 ){
445447
goto tag_cmd_usage;
446448
}
@@ -450,10 +452,13 @@
450452
}
451453
452454
if( strncmp(g.argv[2],"add",n)==0 ){
453455
char *zValue;
454456
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;
455460
const char *zDateOvrd = find_option("date-override",0,1);
456461
const char *zUserOvrd = find_option("user-override",0,1);
457462
if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
458463
if( g.argc!=5 && g.argc!=6 ){
459464
usage("add ?options? TAGNAME CHECK-IN ?VALUE?");
@@ -470,21 +475,29 @@
470475
"Use the \"fossil branch new\" command instead.");
471476
}else
472477
473478
if( strncmp(g.argv[2],"cancel",n)==0 ){
474479
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);
475484
if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
476485
if( g.argc!=5 ){
477486
usage("cancel ?options? TAGNAME CHECK-IN");
478487
}
479488
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);
481491
db_end_transaction(0);
482492
}else
483493
484494
if( strncmp(g.argv[2],"find",n)==0 ){
485495
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;
486499
const char *zType = find_option("type","t",1);
487500
Blob sql = empty_blob;
488501
if( zType==0 || zType[0]==0 ) zType = "*";
489502
if( g.argc!=4 ){
490503
usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME");
@@ -528,10 +541,11 @@
528541
}
529542
}else
530543
531544
if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){
532545
Stmt q;
546
+ int fRaw = find_option("raw","",0)!=0;
533547
if( g.argc==3 ){
534548
db_prepare(&q,
535549
"SELECT tagname FROM tag"
536550
" WHERE EXISTS(SELECT 1 FROM tagxref"
537551
" WHERE tagid=tag.tagid"
@@ -606,20 +620,26 @@
606620
** --test Make database entries but do not add the tag artifact.
607621
** So the reparent operation will be undone by the next
608622
** "fossil rebuild" command.
609623
** --dryrun | -n Print the tag that would have been created but do not
610624
** 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
611627
*/
612628
void reparent_cmd(void){
613629
int bTest = find_option("test","",0)!=0;
614630
int rid;
615631
int i;
616632
Blob value;
617633
char *zUuid;
618634
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 */
619637
620638
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);
621641
db_find_and_open_repository(0, 0);
622642
verify_all_options();
623643
if( g.argc<4 ){
624644
usage("[OPTIONS] CHECK-IN PARENT ...");
625645
}
@@ -634,11 +654,12 @@
634654
}
635655
if( bTest && !dryRun ){
636656
tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid);
637657
}else{
638658
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);
640661
}
641662
}
642663
643664
644665
/*
645666
--- 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 @@
394394
**
395395
** Remove the tag TAGNAME from CHECK-IN, and also remove
396396
** the propagation of the tag to any descendants. Use the
397397
** the --dryrun or -n options to see what would have happened.
398398
**
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
+**
399406
** %fossil tag find ?OPTIONS? TAGNAME
400407
**
401408
** List all objects that use TAGNAME. TYPE can be "ci" for
402409
** check-ins or "e" for events. The limit option limits the number
403410
** of results to the given value.
@@ -432,15 +439,10 @@
432439
** will assume that "decaf" is a tag/branch name.
433440
**
434441
*/
435442
void tag_cmd(void){
436443
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;
442444
443445
db_find_and_open_repository(0, 0);
444446
if( g.argc<3 ){
445447
goto tag_cmd_usage;
446448
}
@@ -450,10 +452,13 @@
450452
}
451453
452454
if( strncmp(g.argv[2],"add",n)==0 ){
453455
char *zValue;
454456
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;
455460
const char *zDateOvrd = find_option("date-override",0,1);
456461
const char *zUserOvrd = find_option("user-override",0,1);
457462
if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
458463
if( g.argc!=5 && g.argc!=6 ){
459464
usage("add ?options? TAGNAME CHECK-IN ?VALUE?");
@@ -470,21 +475,29 @@
470475
"Use the \"fossil branch new\" command instead.");
471476
}else
472477
473478
if( strncmp(g.argv[2],"cancel",n)==0 ){
474479
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);
475484
if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
476485
if( g.argc!=5 ){
477486
usage("cancel ?options? TAGNAME CHECK-IN");
478487
}
479488
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);
481491
db_end_transaction(0);
482492
}else
483493
484494
if( strncmp(g.argv[2],"find",n)==0 ){
485495
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;
486499
const char *zType = find_option("type","t",1);
487500
Blob sql = empty_blob;
488501
if( zType==0 || zType[0]==0 ) zType = "*";
489502
if( g.argc!=4 ){
490503
usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME");
@@ -528,10 +541,11 @@
528541
}
529542
}else
530543
531544
if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){
532545
Stmt q;
546
+ int fRaw = find_option("raw","",0)!=0;
533547
if( g.argc==3 ){
534548
db_prepare(&q,
535549
"SELECT tagname FROM tag"
536550
" WHERE EXISTS(SELECT 1 FROM tagxref"
537551
" WHERE tagid=tag.tagid"
@@ -606,20 +620,26 @@
606620
** --test Make database entries but do not add the tag artifact.
607621
** So the reparent operation will be undone by the next
608622
** "fossil rebuild" command.
609623
** --dryrun | -n Print the tag that would have been created but do not
610624
** 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
611627
*/
612628
void reparent_cmd(void){
613629
int bTest = find_option("test","",0)!=0;
614630
int rid;
615631
int i;
616632
Blob value;
617633
char *zUuid;
618634
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 */
619637
620638
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);
621641
db_find_and_open_repository(0, 0);
622642
verify_all_options();
623643
if( g.argc<4 ){
624644
usage("[OPTIONS] CHECK-IN PARENT ...");
625645
}
@@ -634,11 +654,12 @@
634654
}
635655
if( bTest && !dryRun ){
636656
tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid);
637657
}else{
638658
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);
640661
}
641662
}
642663
643664
644665
/*
645666
--- 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

Keyboard Shortcuts

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