Fossil

Changes On Branch tag-ls-inverse
Login

Changes On Branch tag-ls-inverse

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

Changes In Branch tag-ls-inverse Excluding Merge-Ins

This is equivalent to a diff from 2af7fedd to e170afb9

2020-01-27
06:56
Added --inverse/-v flag to the tag command, as covered in forumpost/d717561e8b7406fc. ... (check-in: 890614f1 user: stephan tags: trunk)
2020-01-08
18:05
Clarified point 2.6 in fossil-v-git.wiki to address feedback from Hacker News user balfirevic here: https://news.ycombinator.com/item?id=21974942 ... (check-in: f6e04cc4 user: wyoung tags: trunk)
17:56
Edit the Executive Summary to mention merge-in: prefix. ... (check-in: 63f50314 user: ashepilko tags: trunk)
2020-01-03
16:39
Add --inverse|-v flag to tag ls, per discussion at https://fossil-scm.org/forum/forumpost/944e611710. ... (Closed-Leaf check-in: e170afb9 user: stephan tags: tag-ls-inverse)
16:34
Merged in trunk. ... (check-in: 5a9414e4 user: stephan tags: forum-edit-deltify)
14:28
Merged in trunk. ... (check-in: 04e1c978 user: stephan tags: mistake)
2020-01-02
14:35
Fix the spelling of "legacy" in the "test-fingerprint" command. Also show the current Fossil version in the "test-fingerprint" command. ... (check-in: 2af7fedd user: drh tags: trunk)
2019-12-26
02:08
Fix a comment describing the meaning of the BACKLINK.SRCID field of the repository schema. No changes to code. ... (check-in: 088aabaf user: drh tags: trunk)

Changes to src/tag.c.

421
422
423
424
425
426
427

428
429
430
431
432
433
434
**         List all tags, or if CHECK-IN is supplied, list
**         all tags and their values for CHECK-IN.  The tagtype option
**         takes one of: propagated, singleton, cancel.
**
**         Options:
**           --raw           List tags raw names of tags
**           --tagtype TYPE  List only tags of type TYPE

**
** The option --raw allows the manipulation of all types of tags
** used for various internal purposes in fossil. It also shows
** "cancel" tags for the "find" and "list" subcommands. You should
** not use this option to make changes unless you are sure what
** you are doing.
**







>







421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
**         List all tags, or if CHECK-IN is supplied, list
**         all tags and their values for CHECK-IN.  The tagtype option
**         takes one of: propagated, singleton, cancel.
**
**         Options:
**           --raw           List tags raw names of tags
**           --tagtype TYPE  List only tags of type TYPE
**           -v|--inverse    Inverse the meaning of --tagtype TYPE.
**
** The option --raw allows the manipulation of all types of tags
** used for various internal purposes in fossil. It also shows
** "cancel" tags for the "find" and "list" subcommands. You should
** not use this option to make changes unless you are sure what
** you are doing.
**
546
547
548
549
550
551
552
553
554

555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
        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 *zTagType = find_option("tagtype","t",1);

    int nTagType = fRaw ? -1 : 0;
    if( zTagType!=0 ){
      int l = strlen(zTagType);
      if( strncmp(zTagType,"cancel",l)==0 ){
        nTagType = 0;
      }else if( strncmp(zTagType,"singleton",l)==0 ){ 
        nTagType = 1;
      }else if( strncmp(zTagType,"propagated",l)==0 ){ 
        nTagType = 2;
      }else{
        fossil_fatal("unrecognized tag type");
      }
    }
    if( g.argc==3 ){
      db_prepare(&q,
        "SELECT tagname FROM tag"
        " WHERE EXISTS(SELECT 1 FROM tagxref"
        "               WHERE tagid=tag.tagid"
        "                 AND tagtype%c%d)"
        " ORDER BY tagname",
        zTagType!=0 ? '=' : '>',
        nTagType
      );
      while( db_step(&q)==SQLITE_ROW ){
        const char *zName = db_column_text(&q, 0);
        if( fRaw ){
          fossil_print("%s\n", zName);
        }else if( strncmp(zName, "sym-", 4)==0 ){
          fossil_print("%s\n", &zName[4]);
        }
      }
      db_finalize(&q);
    }else if( g.argc==4 ){
      int rid = name_to_rid(g.argv[3]);
      db_prepare(&q,
        "SELECT tagname, value FROM tagxref, tag"
        " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
        "   AND tagtype%c%d"
        " ORDER BY tagname",
        rid,
        zTagType!=0 ? '=' : '>',
        nTagType
      );
      while( db_step(&q)==SQLITE_ROW ){
        const char *zName = db_column_text(&q, 0);
        const char *zValue = db_column_text(&q, 1);
        if( fRaw==0 ){
          if( strncmp(zName, "sym-", 4)!=0 ) continue;







|

>


















|

|
















|


|







547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
        db_finalize(&q);
      }
    }
  }else

  if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){
    Stmt q;
    const int fRaw = find_option("raw","",0)!=0;
    const char *zTagType = find_option("tagtype","t",1);
    const int fInverse = find_option("inverse","v",0)!=0;
    int nTagType = fRaw ? -1 : 0;
    if( zTagType!=0 ){
      int l = strlen(zTagType);
      if( strncmp(zTagType,"cancel",l)==0 ){
        nTagType = 0;
      }else if( strncmp(zTagType,"singleton",l)==0 ){ 
        nTagType = 1;
      }else if( strncmp(zTagType,"propagated",l)==0 ){ 
        nTagType = 2;
      }else{
        fossil_fatal("unrecognized tag type");
      }
    }
    if( g.argc==3 ){
      db_prepare(&q,
        "SELECT tagname FROM tag"
        " WHERE EXISTS(SELECT 1 FROM tagxref"
        "               WHERE tagid=tag.tagid"
        "                 AND tagtype%s%d)"
        " ORDER BY tagname",
        zTagType!=0 ? (fInverse!=0?"<>":"=") : ">"/*safe-for-%s*/,
        nTagType
      );
      while( db_step(&q)==SQLITE_ROW ){
        const char *zName = db_column_text(&q, 0);
        if( fRaw ){
          fossil_print("%s\n", zName);
        }else if( strncmp(zName, "sym-", 4)==0 ){
          fossil_print("%s\n", &zName[4]);
        }
      }
      db_finalize(&q);
    }else if( g.argc==4 ){
      int rid = name_to_rid(g.argv[3]);
      db_prepare(&q,
        "SELECT tagname, value FROM tagxref, tag"
        " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
        "   AND tagtype%s%d"
        " ORDER BY tagname",
        rid,
        zTagType!=0 ? (fInverse!=0?"<>":"=") : ">"/*safe-for-%s*/,
        nTagType
      );
      while( db_step(&q)==SQLITE_ROW ){
        const char *zName = db_column_text(&q, 0);
        const char *zValue = db_column_text(&q, 1);
        if( fRaw==0 ){
          if( strncmp(zName, "sym-", 4)!=0 ) continue;