Fossil SCM

Add a --comment option to the tag add subcommand.

roy.marples 2017-02-13 10:53 UTC roy-export
Commit 8b4dfae54b49321e675a5fb301a1dff9af568dbf
2 files changed +2 -2 +7 -3
+2 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -313,12 +313,12 @@
313313
if( rid==0 ) return;
314314
315315
/* Add the trunk tag to the root of the whole tree */
316316
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
317317
if( zUuid==0 ) return;
318
- tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0);
319
- tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0);
318
+ tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0, 0);
319
+ tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0, 0);
320320
}
321321
322322
/*
323323
** Core function to rebuild the information in the derived tables of a
324324
** fossil repository from the blobs. This function is shared between
325325
--- src/rebuild.c
+++ src/rebuild.c
@@ -313,12 +313,12 @@
313 if( rid==0 ) return;
314
315 /* Add the trunk tag to the root of the whole tree */
316 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
317 if( zUuid==0 ) return;
318 tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0);
319 tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0);
320 }
321
322 /*
323 ** Core function to rebuild the information in the derived tables of a
324 ** fossil repository from the blobs. This function is shared between
325
--- src/rebuild.c
+++ src/rebuild.c
@@ -313,12 +313,12 @@
313 if( rid==0 ) return;
314
315 /* Add the trunk tag to the root of the whole tree */
316 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
317 if( zUuid==0 ) return;
318 tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0, 0);
319 tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0, 0);
320 }
321
322 /*
323 ** Core function to rebuild the information in the derived tables of a
324 ** fossil repository from the blobs. This function is shared between
325
+7 -3
--- src/tag.c
+++ src/tag.c
@@ -303,10 +303,11 @@
303303
const char *zPrefix, /* Prefix to prepend to tag name */
304304
const char *zTagname, /* The tag to add or cancel */
305305
const char *zObjName, /* Name of object attached to */
306306
const char *zValue, /* Value for the tag. Might be NULL */
307307
int tagtype, /* 0:cancel 1:singleton 2:propagated */
308
+ const char *zComment, /* Comment for the tag */
308309
const char *zDateOvrd, /* Override date string */
309310
const char *zUserOvrd /* Override user name */
310311
){
311312
int rid;
312313
int nrid;
@@ -340,10 +341,11 @@
340341
" a hexadecimal artifact ID",
341342
zTagname
342343
);
343344
}
344345
#endif
346
+ if( zComment ) blob_appendf(&ctrl, "C %F\n", zComment);
345347
zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now");
346348
blob_appendf(&ctrl, "D %s\n", zDate);
347349
blob_appendf(&ctrl, "T %c%s%F %b",
348350
zTagtype[tagtype], zPrefix, zTagname, &uuid);
349351
if( tagtype>0 && zValue && zValue[0] ){
@@ -380,10 +382,11 @@
380382
** the tag value propagates to all descendants of CHECK-IN
381383
**
382384
** Options:
383385
** --raw Raw tag name.
384386
** --propagate Propagating tag.
387
+** --comment Set a comment for the tag.
385388
** --date-override DATETIME Set date and time added.
386389
** --user-override USER Name USER when adding the tag.
387390
** --dryrun|-n Display the tag text, but do not
388391
** actually insert it into the database.
389392
**
@@ -451,20 +454,21 @@
451454
}
452455
453456
if( strncmp(g.argv[2],"add",n)==0 ){
454457
char *zValue;
455458
int dryRun = 0;
459
+ const char *zComment = find_option("comment",0,1);
456460
const char *zDateOvrd = find_option("date-override",0,1);
457461
const char *zUserOvrd = find_option("user-override",0,1);
458462
if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
459463
if( g.argc!=5 && g.argc!=6 ){
460464
usage("add ?options? TAGNAME CHECK-IN ?VALUE?");
461465
}
462466
zValue = g.argc==6 ? g.argv[5] : 0;
463467
db_begin_transaction();
464468
tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue,
465
- 1+fPropagate+dryRun,zDateOvrd,zUserOvrd);
469
+ 1+fPropagate+dryRun,zComment,zDateOvrd,zUserOvrd);
466470
db_end_transaction(0);
467471
}else
468472
469473
if( strncmp(g.argv[2],"branch",n)==0 ){
470474
fossil_fatal("the \"fossil tag branch\" command is discontinued\n"
@@ -476,11 +480,11 @@
476480
if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
477481
if( g.argc!=5 ){
478482
usage("cancel ?options? TAGNAME CHECK-IN");
479483
}
480484
db_begin_transaction();
481
- tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, 0, 0);
485
+ tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, 0, 0, 0);
482486
db_end_transaction(0);
483487
}else
484488
485489
if( strncmp(g.argv[2],"find",n)==0 ){
486490
Stmt q;
@@ -635,11 +639,11 @@
635639
}
636640
if( bTest && !dryRun ){
637641
tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid, NULL);
638642
}else{
639643
zUuid = rid_to_uuid(rid);
640
- tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0);
644
+ tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0,0);
641645
}
642646
}
643647
644648
645649
/*
646650
--- src/tag.c
+++ src/tag.c
@@ -303,10 +303,11 @@
303 const char *zPrefix, /* Prefix to prepend to tag name */
304 const char *zTagname, /* The tag to add or cancel */
305 const char *zObjName, /* Name of object attached to */
306 const char *zValue, /* Value for the tag. Might be NULL */
307 int tagtype, /* 0:cancel 1:singleton 2:propagated */
 
308 const char *zDateOvrd, /* Override date string */
309 const char *zUserOvrd /* Override user name */
310 ){
311 int rid;
312 int nrid;
@@ -340,10 +341,11 @@
340 " a hexadecimal artifact ID",
341 zTagname
342 );
343 }
344 #endif
 
345 zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now");
346 blob_appendf(&ctrl, "D %s\n", zDate);
347 blob_appendf(&ctrl, "T %c%s%F %b",
348 zTagtype[tagtype], zPrefix, zTagname, &uuid);
349 if( tagtype>0 && zValue && zValue[0] ){
@@ -380,10 +382,11 @@
380 ** the tag value propagates to all descendants of CHECK-IN
381 **
382 ** Options:
383 ** --raw Raw tag name.
384 ** --propagate Propagating tag.
 
385 ** --date-override DATETIME Set date and time added.
386 ** --user-override USER Name USER when adding the tag.
387 ** --dryrun|-n Display the tag text, but do not
388 ** actually insert it into the database.
389 **
@@ -451,20 +454,21 @@
451 }
452
453 if( strncmp(g.argv[2],"add",n)==0 ){
454 char *zValue;
455 int dryRun = 0;
 
456 const char *zDateOvrd = find_option("date-override",0,1);
457 const char *zUserOvrd = find_option("user-override",0,1);
458 if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
459 if( g.argc!=5 && g.argc!=6 ){
460 usage("add ?options? TAGNAME CHECK-IN ?VALUE?");
461 }
462 zValue = g.argc==6 ? g.argv[5] : 0;
463 db_begin_transaction();
464 tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue,
465 1+fPropagate+dryRun,zDateOvrd,zUserOvrd);
466 db_end_transaction(0);
467 }else
468
469 if( strncmp(g.argv[2],"branch",n)==0 ){
470 fossil_fatal("the \"fossil tag branch\" command is discontinued\n"
@@ -476,11 +480,11 @@
476 if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
477 if( g.argc!=5 ){
478 usage("cancel ?options? TAGNAME CHECK-IN");
479 }
480 db_begin_transaction();
481 tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, 0, 0);
482 db_end_transaction(0);
483 }else
484
485 if( strncmp(g.argv[2],"find",n)==0 ){
486 Stmt q;
@@ -635,11 +639,11 @@
635 }
636 if( bTest && !dryRun ){
637 tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid, NULL);
638 }else{
639 zUuid = rid_to_uuid(rid);
640 tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0);
641 }
642 }
643
644
645 /*
646
--- src/tag.c
+++ src/tag.c
@@ -303,10 +303,11 @@
303 const char *zPrefix, /* Prefix to prepend to tag name */
304 const char *zTagname, /* The tag to add or cancel */
305 const char *zObjName, /* Name of object attached to */
306 const char *zValue, /* Value for the tag. Might be NULL */
307 int tagtype, /* 0:cancel 1:singleton 2:propagated */
308 const char *zComment, /* Comment for the tag */
309 const char *zDateOvrd, /* Override date string */
310 const char *zUserOvrd /* Override user name */
311 ){
312 int rid;
313 int nrid;
@@ -340,10 +341,11 @@
341 " a hexadecimal artifact ID",
342 zTagname
343 );
344 }
345 #endif
346 if( zComment ) blob_appendf(&ctrl, "C %F\n", zComment);
347 zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now");
348 blob_appendf(&ctrl, "D %s\n", zDate);
349 blob_appendf(&ctrl, "T %c%s%F %b",
350 zTagtype[tagtype], zPrefix, zTagname, &uuid);
351 if( tagtype>0 && zValue && zValue[0] ){
@@ -380,10 +382,11 @@
382 ** the tag value propagates to all descendants of CHECK-IN
383 **
384 ** Options:
385 ** --raw Raw tag name.
386 ** --propagate Propagating tag.
387 ** --comment Set a comment for the tag.
388 ** --date-override DATETIME Set date and time added.
389 ** --user-override USER Name USER when adding the tag.
390 ** --dryrun|-n Display the tag text, but do not
391 ** actually insert it into the database.
392 **
@@ -451,20 +454,21 @@
454 }
455
456 if( strncmp(g.argv[2],"add",n)==0 ){
457 char *zValue;
458 int dryRun = 0;
459 const char *zComment = find_option("comment",0,1);
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?");
465 }
466 zValue = g.argc==6 ? g.argv[5] : 0;
467 db_begin_transaction();
468 tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue,
469 1+fPropagate+dryRun,zComment,zDateOvrd,zUserOvrd);
470 db_end_transaction(0);
471 }else
472
473 if( strncmp(g.argv[2],"branch",n)==0 ){
474 fossil_fatal("the \"fossil tag branch\" command is discontinued\n"
@@ -476,11 +480,11 @@
480 if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
481 if( g.argc!=5 ){
482 usage("cancel ?options? TAGNAME CHECK-IN");
483 }
484 db_begin_transaction();
485 tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, 0, 0, 0);
486 db_end_transaction(0);
487 }else
488
489 if( strncmp(g.argv[2],"find",n)==0 ){
490 Stmt q;
@@ -635,11 +639,11 @@
639 }
640 if( bTest && !dryRun ){
641 tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid, NULL);
642 }else{
643 zUuid = rid_to_uuid(rid);
644 tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0,0);
645 }
646 }
647
648
649 /*
650

Keyboard Shortcuts

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