Fossil SCM
Add a --comment option to the tag add subcommand.
Commit
8b4dfae54b49321e675a5fb301a1dff9af568dbf
Parent
752bdd38c73da12…
2 files changed
+2
-2
+7
-3
+2
-2
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -313,12 +313,12 @@ | ||
| 313 | 313 | if( rid==0 ) return; |
| 314 | 314 | |
| 315 | 315 | /* Add the trunk tag to the root of the whole tree */ |
| 316 | 316 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 317 | 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); | |
| 318 | + tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0, 0); | |
| 319 | + tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0, 0); | |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /* |
| 323 | 323 | ** Core function to rebuild the information in the derived tables of a |
| 324 | 324 | ** fossil repository from the blobs. This function is shared between |
| 325 | 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); |
| 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 @@ | ||
| 303 | 303 | const char *zPrefix, /* Prefix to prepend to tag name */ |
| 304 | 304 | const char *zTagname, /* The tag to add or cancel */ |
| 305 | 305 | const char *zObjName, /* Name of object attached to */ |
| 306 | 306 | const char *zValue, /* Value for the tag. Might be NULL */ |
| 307 | 307 | int tagtype, /* 0:cancel 1:singleton 2:propagated */ |
| 308 | + const char *zComment, /* Comment for the tag */ | |
| 308 | 309 | const char *zDateOvrd, /* Override date string */ |
| 309 | 310 | const char *zUserOvrd /* Override user name */ |
| 310 | 311 | ){ |
| 311 | 312 | int rid; |
| 312 | 313 | int nrid; |
| @@ -340,10 +341,11 @@ | ||
| 340 | 341 | " a hexadecimal artifact ID", |
| 341 | 342 | zTagname |
| 342 | 343 | ); |
| 343 | 344 | } |
| 344 | 345 | #endif |
| 346 | + if( zComment ) blob_appendf(&ctrl, "C %F\n", zComment); | |
| 345 | 347 | zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now"); |
| 346 | 348 | blob_appendf(&ctrl, "D %s\n", zDate); |
| 347 | 349 | blob_appendf(&ctrl, "T %c%s%F %b", |
| 348 | 350 | zTagtype[tagtype], zPrefix, zTagname, &uuid); |
| 349 | 351 | if( tagtype>0 && zValue && zValue[0] ){ |
| @@ -380,10 +382,11 @@ | ||
| 380 | 382 | ** the tag value propagates to all descendants of CHECK-IN |
| 381 | 383 | ** |
| 382 | 384 | ** Options: |
| 383 | 385 | ** --raw Raw tag name. |
| 384 | 386 | ** --propagate Propagating tag. |
| 387 | +** --comment Set a comment for the tag. | |
| 385 | 388 | ** --date-override DATETIME Set date and time added. |
| 386 | 389 | ** --user-override USER Name USER when adding the tag. |
| 387 | 390 | ** --dryrun|-n Display the tag text, but do not |
| 388 | 391 | ** actually insert it into the database. |
| 389 | 392 | ** |
| @@ -451,20 +454,21 @@ | ||
| 451 | 454 | } |
| 452 | 455 | |
| 453 | 456 | if( strncmp(g.argv[2],"add",n)==0 ){ |
| 454 | 457 | char *zValue; |
| 455 | 458 | int dryRun = 0; |
| 459 | + const char *zComment = find_option("comment",0,1); | |
| 456 | 460 | const char *zDateOvrd = find_option("date-override",0,1); |
| 457 | 461 | const char *zUserOvrd = find_option("user-override",0,1); |
| 458 | 462 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 459 | 463 | if( g.argc!=5 && g.argc!=6 ){ |
| 460 | 464 | usage("add ?options? TAGNAME CHECK-IN ?VALUE?"); |
| 461 | 465 | } |
| 462 | 466 | zValue = g.argc==6 ? g.argv[5] : 0; |
| 463 | 467 | db_begin_transaction(); |
| 464 | 468 | tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue, |
| 465 | - 1+fPropagate+dryRun,zDateOvrd,zUserOvrd); | |
| 469 | + 1+fPropagate+dryRun,zComment,zDateOvrd,zUserOvrd); | |
| 466 | 470 | db_end_transaction(0); |
| 467 | 471 | }else |
| 468 | 472 | |
| 469 | 473 | if( strncmp(g.argv[2],"branch",n)==0 ){ |
| 470 | 474 | fossil_fatal("the \"fossil tag branch\" command is discontinued\n" |
| @@ -476,11 +480,11 @@ | ||
| 476 | 480 | if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; |
| 477 | 481 | if( g.argc!=5 ){ |
| 478 | 482 | usage("cancel ?options? TAGNAME CHECK-IN"); |
| 479 | 483 | } |
| 480 | 484 | 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); | |
| 482 | 486 | db_end_transaction(0); |
| 483 | 487 | }else |
| 484 | 488 | |
| 485 | 489 | if( strncmp(g.argv[2],"find",n)==0 ){ |
| 486 | 490 | Stmt q; |
| @@ -635,11 +639,11 @@ | ||
| 635 | 639 | } |
| 636 | 640 | if( bTest && !dryRun ){ |
| 637 | 641 | tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid, NULL); |
| 638 | 642 | }else{ |
| 639 | 643 | 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); | |
| 641 | 645 | } |
| 642 | 646 | } |
| 643 | 647 | |
| 644 | 648 | |
| 645 | 649 | /* |
| 646 | 650 |
| --- 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 |