Remove tag
(1) By TomaszDrozdz on 2020-01-03 08:27:33 [source]
Is there any way to remove unused, unneeded tag ?
(2) By Stephan Beal (stephan) on 2020-01-03 10:31:35 in reply to 1 [link] [source]
You cannot actually remove it, but you can "cancel" it so that it no longer applies as of the time it is cancelled (unless i am very sorely mistaken, it still applies in views involving times prior to that). See:
https://www.fossil-scm.org/fossil/help?cmd=tag
and search for "cancel".
(3.1) By TomaszDrozdz on 2020-01-03 11:24:51 edited from 3.0 in reply to 2 [link] [source]
So maybe we can have option to hide / not show any canceled tag ?
I mean in command line there is option to show only e.g. canceled tag, but no option to show any tag except canceled.
And there is no option for this in WEB UI.
(4) By Stephan Beal (stephan) on 2020-01-03 11:35:37 in reply to 3.1 [link] [source]
Canceling a tag effectively hides that tag, so filtering any content by a given tag will not show content in which that tag was canceled. Showing canceled tags would require going through the whole history to look for such a cancelation and would seem(?) to provide no(?) useful/actionable information.
Perhaps a description of a concrete problem you're trying to solve would make it clearer for me.
(5.1) By TomaszDrozdz on 2020-01-03 12:07:50 edited from 5.0 in reply to 4 [link] [source]
I had created tech-note and by mistake put 75da39b0b4 in tags field.
Then I have cleaned tags field for this tech-note.
Then canceled this tag.
Now:
fossil tag find 75da39b0b4
+++ no more data (0) +++
and also in WEB UI:
0 check-ins tagged with "75da39b0b4"
but:
fossil tags ls
and WEB UI still show this tag.
(6) By Stephan Beal (stephan) on 2020-01-03 12:17:12 in reply to 5.1 [link] [source]
Now:
fossil tag find 75da39b0b4
+++ no more data (0) +++
That's correct. The help text for "tag find" says "List all objects that use TAGNAME", but a cancelled tag is no longer "in use."
and also in WEB UI:
0 check-ins tagged with "75da39b0b4"
That's also correct: no checkin has that tag.
but:
fossil tags ls
Also correct: "tag ls" says "list all tags", and that tag exists, even though nothing is currently tagged with it.
and WEB UI still show this tag.
You'll need to be more specific about which page you mean.
Whether or not a cancelled tag shows up, or should show up, is context-dependent.
(7) By TomaszDrozdz on 2020-01-03 12:32:15 in reply to 6 [link] [source]
OK.
I think it would be nice to have something like:
fossil tags ls --type=!cancel
so I could see all tags except 75da39b0b4.
Also WEB UI page taglist - "Non-propagating tags" - the one You go to by clicking "Tags" "button" / link in the navigation menu has no filters.
Would be nice to have some filters,
so I could see all tags except 75da39b0b4.
(8) By Stephan Beal (stephan) on 2020-01-03 13:32:41 in reply to 7 [link] [source]
I think it would be nice to have something like:
fossil tags ls --type=!cancel
As a user, are you really going to want to type that out every time just to filter out a single accidental tag?
(Sidebar: !
has a special meaning in Unix shells: try typing echo a=!b
in a shell.)
tag ls
has a flag called --tagtype
which accepts one of (propagated, singleton, cancel). Though i have not looked at the code, it would "probably" be a simple matter to add an --inverse
option which reverses the meaning of those, so you could do tag ls --tagtype cancel --inverse
.
Also WEB UI page taglist - "Non-propagating tags" - the one You go to by clicking "Tags" "button" / link in the navigation menu has no filters. Would be nice to have some filters, so I could see all tags except 75da39b0b4.
How do you envision a user making use of such a filter? Typing in the name of a tag you don't want to see is not realistic for a tag named 75da39b0b4
because you'll never remember its name. Selecting a single tag from the list to filter out from tags page doesn't seem terribly useful, as it would filter out only that one entry and re-render the page.
It sounds like you want this feature only to hide a single accidental tag, rather than solve a general problem. If that's the case, it's unlikely that someone else is going to want to implement it, but, as always, patches are thoughtfully considered!
(9) By Stephan Beal (stephan) on 2020-01-03 13:43:38 in reply to 8 [link] [source]
tag ls has a flag called --tagtype...
Taking a closer look at that, it seems to do what you're asking, in that cancel tags do not show up when one of the other tag types is given:
[stephan@lapdog:~/fossil/fossil]$ ./fossil tag ls --tagtype cancel | head
Mistake
StvPrivateHook2
StvPrivateHook2 --bgcolor yellow --private
a893fff3ca2fb9f0
allow-backslash-in-card-filename
andygoth-brackets-outside-ilnk
andygoth-enhanced-changes
andygoth-import-rename
andygoth-metata-info
annotate_noleak
[stephan@lapdog:~/fossil/fossil]$ ./fossil tag ls --tagtype propagate | grep a893fff3ca2fb9f0
[stephan@lapdog:~/fossil/fossil]$ ./fossil tag ls --tagtype singleton | grep a893fff3ca2fb9f0
i have locally implemented an -invert
option, so that ls --tagtype cancel
effective becomes ls --tagtype !cancel
, but find the results somewhat confusing, so do not intend to commit it.
(10) By TomaszDrozdz on 2020-01-03 13:48:40 in reply to 8 [link] [source]
I can imagine after some time, there can be a lot of canceled tags - depending how many peoples worked on repo and how experienced they were.
fossil tag ls --tagtype cancel --inverse
would be nice and full sufficient.
In WEB UI simple filter with the same choices:
- propagated
- singleton
- cancel
and checkbox "inverse" would also be nice and full sufficient.
(11) By Stephan Beal (stephan) on 2020-01-03 14:03:33 in reply to 10 [link] [source]
fossil tag ls --tagtype cancel --inverse
would be nice and full sufficient.
You're in luck, because that's exactly tag ls
does if you don't pass it any flags.
Output from my local version, which has an -inverse
option, running against the main fossil repo:
./fossil tag ls > x
./fossil tag ls --tagtype cancel --inverse > y
diff x y
<no output>
wc -l x y
801 x
801 y
1602 total
The only(?) real use for the inverse flag would be to filter out cancelled flags, which is already the default behaviour, so i currently have no plans to check in this change.
For completeness's sake, here's the full diff for the -inverse
feature:
[stephan@lapdog:~/fossil/fossil]$ f diff
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);
(12) By TomaszDrozdz on 2020-01-03 14:54:33 in reply to 11 [link] [source]
Thank You for Your effort of investigating it.
Sadly in my repo:
fossil tag ls
shows canceled tags.
(13) By Stephan Beal (stephan) on 2020-01-03 14:59:26 in reply to 12 [link] [source]
Indeed, you're correct - my logic/thinking was wrong. ls
by itself shows all tags, including cancelled ones.
After i have straightened out a blunder i made on my local copy i will commit the -inverse
flag to a branch so you can try it out.
(14) By TomaszDrozdz on 2020-01-03 15:15:00 in reply to 13 [link] [source]
Thank You!
I just had idea, I shared it on this forum and now Fossil is a bit improved.
That is why I like it.
If someone, someday could also add this --tagtype and --inverse functionality to WEB UI
that would be really great indeed.
(15) By Stephan Beal (stephan) on 2020-01-03 15:16:46 in reply to 14 [link] [source]
If someone, someday could also add this --tagtype and --inverse functionality to WEB UI that would be really great indeed.
i'm going to leave that one for someone else to do ;).
(16) By Stephan Beal (stephan) on 2020-01-03 16:43:14 in reply to 13 [link] [source]
i have checked in the --inverse
flag to tag ls
in a new branch:
https://fossil-scm.org/fossil/timeline?r=tag-ls-inverse
It "works for me," but if you could test it out, that would be great.
i'm not yet convinced that it's generally useful, though.
./fossil help tag
...
./fossil tag list|ls ?OPTIONS? ?CHECK-IN?
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.