repoview: add non-global tags to candidate list for blocking hidden changesets
authorSean Farley <sean.michael.farley@gmail.com>
Tue, 18 Mar 2014 20:10:33 -0500
changeset 20807 91d28bd0e04e
parent 20806 d66862b87ae6
child 20808 4c9130c7a29f
repoview: add non-global tags to candidate list for blocking hidden changesets Previously, only bookmarks would be considered for blocking a changeset from being hidden. Now, we also consider non-global tags. This is helpful if we have local tags that might be hard to find once they are hidden, or tag that are added by extensions (e.g. hggit or remotebranches).
mercurial/repoview.py
tests/test-obsolete.t
--- a/mercurial/repoview.py	Thu Mar 13 16:05:06 2014 -0700
+++ b/mercurial/repoview.py	Tue Mar 18 20:10:33 2014 -0500
@@ -35,6 +35,9 @@
             blockers.append(par.rev())
         for bm in repo._bookmarks.values():
             blockers.append(repo[bm].rev())
+        tags = [n for t, n in repo.tags().iteritems()
+                if (repo.tagtype(t) and repo.tagtype(t) != 'global')]
+        blockers.extend(repo[t].rev() for t in tags)
         blocked = cl.ancestors(blockers, inclusive=True)
         return frozenset(r for r in hideable if r not in blocked)
     return frozenset()
--- a/tests/test-obsolete.t	Thu Mar 13 16:05:06 2014 -0700
+++ b/tests/test-obsolete.t	Tue Mar 18 20:10:33 2014 -0500
@@ -884,4 +884,20 @@
   no changes found
   [1]
 
+Test that a local tag blocks a changeset from being hidden
 
+  $ hg tag -l visible -r 0 --hidden
+  $ hg log -G
+  @  changeset:   2:3816541e5485
+     tag:         tip
+     parent:      -1:000000000000
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+  
+  x  changeset:   0:193e9254ce7e
+     tag:         visible
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+