Index: src/tag.c ================================================================== --- src/tag.c +++ src/tag.c @@ -423,10 +423,11 @@ ** 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 @@ -548,12 +549,13 @@ } }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 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; @@ -568,13 +570,13 @@ 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)" + " AND tagtype%s%d)" " ORDER BY tagname", - zTagType!=0 ? '=' : '>', + zTagType!=0 ? (fInverse!=0?"<>":"=") : ">"/*safe-for-%s*/, nTagType ); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); if( fRaw ){ @@ -587,14 +589,14 @@ }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" + " AND tagtype%s%d" " ORDER BY tagname", rid, - zTagType!=0 ? '=' : '>', + 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);