Fossil

Check-in [5d5252b8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | cmd-options-amend
Files: files | file ages | folders
SHA3-256: 5d5252b8846012b321ab5ee7b43727b559270a40a438341cfa5d1d3a32954578
User & Date: florian 2018-12-26 14:17:00
Context
2018-12-26
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
08:02
Enhance the options for the 'reparent' command: add --date-override and --user-override check-in: df85c3f9 user: florian tags: cmd-options-amend
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/tag.c.

433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
...
479
480
481
482
483
484
485


486
487
488
489
490
491
492
**
*/
void tag_cmd(void){
  int n;
  int fRaw = find_option("raw","",0)!=0;
  int fPropagate = find_option("propagate","",0)!=0;
  const char *zPrefix = fRaw ? "" : "sym-";
  const char *zFindLimit = find_option("limit","n",1);
  const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000;

  db_find_and_open_repository(0, 0);
  if( g.argc<3 ){
    goto tag_cmd_usage;
  }
  n = strlen(g.argv[2]);
  if( n==0 ){
................................................................................
    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;


    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");
    }
    if( fRaw ){







<
<







 







>
>







433
434
435
436
437
438
439


440
441
442
443
444
445
446
...
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
**
*/
void tag_cmd(void){
  int n;
  int fRaw = find_option("raw","",0)!=0;
  int fPropagate = find_option("propagate","",0)!=0;
  const char *zPrefix = fRaw ? "" : "sym-";



  db_find_and_open_repository(0, 0);
  if( g.argc<3 ){
    goto tag_cmd_usage;
  }
  n = strlen(g.argv[2]);
  if( n==0 ){
................................................................................
    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;
    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");
    }
    if( fRaw ){