[PATCH V3] repoview: add non-global tags to candidate list for blocking hidden changesets

Sean Farley sean.michael.farley at gmail.com
Wed Mar 19 12:11:49 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1395191433 18000
#      Tue Mar 18 20:10:33 2014 -0500
# Node ID 217a6716a2753174b8c0eb346ac9e7ca9f15f4b7
# Parent  efbf15979538a1e32fb70bf89de7c60f8ead5909
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).

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -33,10 +33,13 @@ def computehidden(repo):
         blockers = [r for r in tofilter if r not in hideable]
         for par in repo[None].parents():
             blockers.append(par.rev())
         for bm in repo._bookmarks.values():
             blockers.append(repo[bm].rev())
+        tags = [t for t in repo.tags()
+                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()
 
 def computeunserved(repo):
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -882,6 +882,22 @@ This test issue 3814
   comparing with ../repo-issue3814
   searching for changes
   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
+  


More information about the Mercurial-devel mailing list