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

login
register
mail settings
Submitter Sean Farley
Date March 19, 2014, 5:04 a.m.
Message ID <7290d5a92ebb48e39125.1395205479@laptop.local>
Download mbox | patch
Permalink /patch/3987/
State Superseded
Commit 77c7ff36e36b244f0bf379d8fbf35af330fe573f
Headers show

Comments

Sean Farley - March 19, 2014, 5:04 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1395191433 18000
#      Tue Mar 18 20:10:33 2014 -0500
# Node ID 7290d5a92ebb48e391254554daee2dd6d8212999
# 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).
Pierre-Yves David - March 19, 2014, 6:06 a.m.
On 03/18/2014 10:04 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1395191433 18000
> #      Tue Mar 18 20:10:33 2014 -0500
> # Node ID 7290d5a92ebb48e391254554daee2dd6d8212999
> # 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,14 @@ 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')]
> +        for t in tags:
> +            blockers.append(repo[t].rev())
>           blocked = cl.ancestors(blockers, inclusive=True)
>           return frozenset(r for r in hideable if r not in blocked)
>       return frozenset()
>
>   def computeunserved(repo):

The code itself looks good. Eager to see the test ;-)

small nit:

   blocked.update(repo[t].rev() for t in tags)

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -33,10 +33,14 @@  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')]
+        for t in tags:
+            blockers.append(repo[t].rev())
         blocked = cl.ancestors(blockers, inclusive=True)
         return frozenset(r for r in hideable if r not in blocked)
     return frozenset()
 
 def computeunserved(repo):