Fossil

Check-in [7c281b62]
Login

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

Overview
Comment:Prevent tag cancellations from showing in "fossil tag list" and "fossil tag find", and also on the tagview web page, but make them visible with "--raw" or on the RawTags webpage (admin only). Fixes ticket [f273b440c38eb8478822812e0730f0fc2c8b4c36].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7c281b629ac5c6a91b2b8143fe48a5714f54e0df
User & Date: eric 2008-12-20 11:36:20
References
2008-12-20
11:39 Fixed ticket [f273b440]: fossil tag cancel has no effect? plus 2 other changes artifact: 8326e975 user: eric
Context
2008-12-21
16:36
cli docs check-in: aef81bf3 user: kejoki tags: trunk
2008-12-20
11:36
Prevent tag cancellations from showing in "fossil tag list" and "fossil tag find", and also on the tagview web page, but make them visible with "--raw" or on the RawTags webpage (admin only). Fixes ticket [f273b440c38eb8478822812e0730f0fc2c8b4c36]. check-in: 7c281b62 user: eric tags: trunk
02:23
Fix an SQL syntax error. Ticket [62c84f3e604a06f9b8f3f4ca39f774d6909115aa]. check-in: 491b2c69 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/tag.c.

401
402
403
404
405
406
407
408
409

410
411
412
413
414
415
416
417
418
...
481
482
483
484
485
486
487

488
489
490
491
492
493
494
495
...
496
497
498
499
500
501
502
503
504

505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520

521
522
523
524
525
526
527
**         List all baselines that use TAGNAME
**
**     %fossil tag list ?--raw? ?BASELINE?
**
**         List all tags, or if BASELINE is supplied, list
**         all tags and their values for BASELINE.
**
** The option --raw allows the manipulation of all types of
** tags used for various internal purposes in fossil. You

** should not use this option to make changes unless you are
** sure what you are doing.
**
** If you need to use a tagname that might be confused with
** a hexadecimal baseline or artifact ID, you can explicitly
** disambiguate it by prefixing it with "tag:". For instance:
**
**   fossil update decaf
**
................................................................................
    if( g.argc!=4 ){
      usage("find ?--raw? TAGNAME");
    }
    blob_append(&tagname, g.argv[3], strlen(g.argv[3]));
    db_prepare(&q,
      "SELECT blob.uuid FROM tagxref, blob"
      " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%B)"

      "   AND blob.rid=tagxref.rid", &tagname
    );
    while( db_step(&q)==SQLITE_ROW ){
      printf("%s\n", db_column_text(&q, 0));
    }
    db_finalize(&q);
  }else

................................................................................
  if( strncmp(g.argv[2],"list",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"

      );
      while( db_step(&q)==SQLITE_ROW ){
        const char *name = db_column_text(&q, 0);
        if( raw || strncmp(name, prefix, preflen)==0 ){
          printf("%s\n", name+preflen);
        }
      }
      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>0"
        " ORDER BY tagname",
        rid

      );
      while( db_step(&q)==SQLITE_ROW ){
        const char *zName = db_column_text(&q, 0);
        const char *zValue = db_column_text(&q, 1);
        if( zValue ){
          if( raw || strncmp(zName, prefix, preflen)==0 ){
            printf("%s=%s\n", zName+preflen, zValue);







|
|
>
|
|







 







>
|







 







|
|
>













|

|
>







401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
...
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
...
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
**         List all baselines that use TAGNAME
**
**     %fossil tag list ?--raw? ?BASELINE?
**
**         List all tags, or if BASELINE is supplied, list
**         all tags and their values for BASELINE.
**
** 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.
**
** If you need to use a tagname that might be confused with
** a hexadecimal baseline or artifact ID, you can explicitly
** disambiguate it by prefixing it with "tag:". For instance:
**
**   fossil update decaf
**
................................................................................
    if( g.argc!=4 ){
      usage("find ?--raw? TAGNAME");
    }
    blob_append(&tagname, g.argv[3], strlen(g.argv[3]));
    db_prepare(&q,
      "SELECT blob.uuid FROM tagxref, blob"
      " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%B)"
      "   AND tagxref.tagtype > %d"
      "   AND blob.rid=tagxref.rid", &tagname, raw ? -1 : 0
    );
    while( db_step(&q)==SQLITE_ROW ){
      printf("%s\n", db_column_text(&q, 0));
    }
    db_finalize(&q);
  }else

................................................................................
  if( strncmp(g.argv[2],"list",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>%d)"
        " ORDER BY tagname",
        raw ? -1 : 0
      );
      while( db_step(&q)==SQLITE_ROW ){
        const char *name = db_column_text(&q, 0);
        if( raw || strncmp(name, prefix, preflen)==0 ){
          printf("%s\n", name+preflen);
        }
      }
      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>%d"
        " ORDER BY tagname",
        rid,
        raw ? -1 : 0
      );
      while( db_step(&q)==SQLITE_ROW ){
        const char *zName = db_column_text(&q, 0);
        const char *zValue = db_column_text(&q, 1);
        if( zValue ){
          if( raw || strncmp(zName, prefix, preflen)==0 ){
            printf("%s=%s\n", zName+preflen, zValue);

Changes to src/tagview.c.

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
...
172
173
174
175
176
177
178

179
180
181
182
183
184
185
    "SELECT "
    "   linktagid(t.tagid) AS 'Tag ID',"
    "   linktagname(t.tagname) AS 'Name',"
    "   DATETIME(tx.mtime) AS 'Timestamp',"
    "   linkuuid(b.uuid) AS 'Version'"
    "  FROM tag t, tagxref tx, blob b "
    " WHERE t.tagid=tx.tagid AND tx.rid=b.rid"
    "   AND tx.tagtype!=0 %s "
    TAGVIEW_DEFAULT_FILTER
    " ORDER BY tx.mtime DESC %s",
    zLikeClause, zLimit
  );
  db_generic_query_view(zSql, 1);
  free(zSql);
  if( zLikeClause[0] ) free(zLikeClause);
................................................................................
*/
void tagview_print_timeline(char const *pName, char const *pPrefix){
  char *zSql;
  Stmt q;
  zSql = mprintf("%s AND EXISTS (SELECT 1"
         " FROM tagxref"
         "  WHERE tagxref.rid = event.objid"

         "  AND tagxref.tagid = (SELECT tagid FROM tag"
         "      WHERE tagname = %Q||%Q))"
         " ORDER BY 3 desc",
         timeline_query_for_www(), pPrefix, pName);
  db_prepare(&q, zSql);
  free(zSql);
  www_print_timeline(&q);







|







 







>







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
    "SELECT "
    "   linktagid(t.tagid) AS 'Tag ID',"
    "   linktagname(t.tagname) AS 'Name',"
    "   DATETIME(tx.mtime) AS 'Timestamp',"
    "   linkuuid(b.uuid) AS 'Version'"
    "  FROM tag t, tagxref tx, blob b "
    " WHERE t.tagid=tx.tagid AND tx.rid=b.rid"
    " %s "
    TAGVIEW_DEFAULT_FILTER
    " ORDER BY tx.mtime DESC %s",
    zLikeClause, zLimit
  );
  db_generic_query_view(zSql, 1);
  free(zSql);
  if( zLikeClause[0] ) free(zLikeClause);
................................................................................
*/
void tagview_print_timeline(char const *pName, char const *pPrefix){
  char *zSql;
  Stmt q;
  zSql = mprintf("%s AND EXISTS (SELECT 1"
         " FROM tagxref"
         "  WHERE tagxref.rid = event.objid"
         "  AND tagxref.tagtype > 0"
         "  AND tagxref.tagid = (SELECT tagid FROM tag"
         "      WHERE tagname = %Q||%Q))"
         " ORDER BY 3 desc",
         timeline_query_for_www(), pPrefix, pName);
  db_prepare(&q, zSql);
  free(zSql);
  www_print_timeline(&q);