Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | For the 'tag' command, parse all options after the sub-commands, so that no unsupported options can be used (for example, disallow 'fossil tag cancel --propagate ...'), and to have a consistent command-line format with sub-commands followed by options |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | cmd-options-amend |
Files: | files | file ages | folders |
SHA3-256: |
2efcd19f14a0f9526184e4d15d02ea8a |
User & Date: | florian 2018-12-26 14:25:00.000 |
References
2018-12-27
| ||
12:36 | Remove two unused variables (introduced by [2efcd19f14] through copy-and-paste) ... (Closed-Leaf check-in: cf0f6fc8 user: florian tags: cmd-options-amend) | |
Context
2018-12-26
| ||
14:38 | Enhance the options for the 'tag cancel' command: add --date-override and --user-override, and show a summary for the help text ... (check-in: 8f2d519b user: florian tags: cmd-options-amend) | |
14:25 | For the 'tag' command, parse all options after the sub-commands, so that no unsupported options can be used (for example, disallow 'fossil tag cancel --propagate ...'), and to have a consistent command-line format with sub-commands followed by options ... (check-in: 2efcd19f user: florian tags: cmd-options-amend) | |
14:17 | For the 'tag find' command, move parsing of the -n|--limit option to the innermost scope, to avoid conflicts with the 'tag add' variant of the -n|--dryrun option ... (check-in: 5d5252b8 user: florian tags: cmd-options-amend) | |
Changes
Changes to src/tag.c.
︙ | ︙ | |||
430 431 432 433 434 435 436 | ** fossil update tag:decaf ** ** will assume that "decaf" is a tag/branch name. ** */ void tag_cmd(void){ int n; | < < < > > > > > > > | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | ** fossil update tag:decaf ** ** will assume that "decaf" is a tag/branch name. ** */ void tag_cmd(void){ int n; db_find_and_open_repository(0, 0); if( g.argc<3 ){ goto tag_cmd_usage; } n = strlen(g.argv[2]); if( n==0 ){ goto tag_cmd_usage; } if( strncmp(g.argv[2],"add",n)==0 ){ char *zValue; int dryRun = 0; int fRaw = find_option("raw","",0)!=0; const char *zPrefix = fRaw ? "" : "sym-"; int fPropagate = find_option("propagate","",0)!=0; const char *zDateOvrd = find_option("date-override",0,1); const char *zUserOvrd = find_option("user-override",0,1); if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; if( g.argc!=5 && g.argc!=6 ){ usage("add ?options? TAGNAME CHECK-IN ?VALUE?"); } zValue = g.argc==6 ? g.argv[5] : 0; db_begin_transaction(); tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue, 1+fPropagate+dryRun,zDateOvrd,zUserOvrd); db_end_transaction(0); }else if( strncmp(g.argv[2],"branch",n)==0 ){ fossil_fatal("the \"fossil tag branch\" command is discontinued\n" "Use the \"fossil branch new\" command instead."); }else if( strncmp(g.argv[2],"cancel",n)==0 ){ int dryRun = 0; int fRaw = find_option("raw","",0)!=0; const char *zPrefix = fRaw ? "" : "sym-"; if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; if( g.argc!=5 ){ usage("cancel ?options? TAGNAME CHECK-IN"); } db_begin_transaction(); tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, 0, 0); db_end_transaction(0); }else if( strncmp(g.argv[2],"find",n)==0 ){ Stmt q; int fRaw = find_option("raw","",0)!=0; const char *zPrefix = fRaw ? "" : "sym-"; const char *zFindLimit = find_option("limit","n",1); const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; const char *zType = find_option("type","t",1); Blob sql = empty_blob; if( zType==0 || zType[0]==0 ) zType = "*"; if( g.argc!=4 ){ usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME"); |
︙ | ︙ | |||
526 527 528 529 530 531 532 533 534 535 536 537 538 539 | db_finalize(&q); } } }else if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ Stmt q; if( g.argc==3 ){ db_prepare(&q, "SELECT tagname FROM tag" " WHERE EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=tag.tagid" " AND tagtype>0)" " ORDER BY tagname" | > > | 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | db_finalize(&q); } } }else if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ Stmt q; int fRaw = find_option("raw","",0)!=0; const char *zPrefix = fRaw ? "" : "sym-"; if( g.argc==3 ){ db_prepare(&q, "SELECT tagname FROM tag" " WHERE EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=tag.tagid" " AND tagtype>0)" " ORDER BY tagname" |
︙ | ︙ |