localrepo: don't reintroduce pruned tag entries when tagging
If a commit and a followup tag commit are pruned, there are no references to it
in any non obsolete version of .hgtags. Without this change however, the next
time a tag is added to another branch, the obsolete references are appended in
.hgtags before the new entries for the current tag command.
The annotation to unfilter localrepo._tag() has been around since b3af182a1944.
The log message for it mentions computing the tag cache though, so I'm not sure
if this was misplaced? It looks like branchmap was aware of filtering then, and
now tracks a cache per view.
--- a/mercurial/localrepo.py Thu Feb 05 13:10:07 2015 -0800
+++ b/mercurial/localrepo.py Wed Oct 01 20:26:33 2014 -0400
@@ -504,7 +504,6 @@
"""
return hook.hook(self.ui, self, name, throw, **args)
- @unfilteredmethod
def _tag(self, names, node, message, local, user, date, extra={},
editor=False):
if isinstance(names, str):
--- a/tests/test-obsolete.t Thu Feb 05 13:10:07 2015 -0800
+++ b/tests/test-obsolete.t Wed Oct 01 20:26:33 2014 -0400
@@ -753,3 +753,45 @@
$ hg tags
visible 0:193e9254ce7e
tip 0:193e9254ce7e
+
+ $ hg init a
+ $ cd a
+ $ touch foo
+ $ hg add foo
+ $ hg ci -mfoo
+ $ touch bar
+ $ hg add bar
+ $ hg ci -mbar
+ $ hg up 0
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ touch quux
+ $ hg add quux
+ $ hg ci -m quux
+ created new head
+ $ hg up 1
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ hg tag 1.0
+
+ $ hg up 2
+ 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ hg log -G
+ o 3:bc47fc7e1c1d (draft) [tip ] Added tag 1.0 for changeset 50c889141114
+ |
+ | @ 2:3d7f255a0081 (draft) [ ] quux
+ | |
+ o | 1:50c889141114 (draft) [1.0 ] bar
+ |/
+ o 0:1f7b0de80e11 (draft) [ ] foo
+
+ $ hg debugobsolete `getid bar`
+ $ hg debugobsolete `getid 1.0`
+ $ hg tag 1.0
+ $ hg log -G
+ @ 4:f9f2ab71ffd5 (draft) [tip ] Added tag 1.0 for changeset 3d7f255a0081
+ |
+ o 2:3d7f255a0081 (draft) [1.0 ] quux
+ |
+ o 0:1f7b0de80e11 (draft) [ ] foo
+
+ $ cat .hgtags
+ 3d7f255a008103380aeb2a7d581fe257f40969e7 1.0