Patchwork [RFC] repoview: add tags to candidate list for blocking hidden changesets

login
register
mail settings
Submitter Sean Farley
Date March 19, 2014, 1:11 a.m.
Message ID <9d9821e223edb30fa8dd.1395191501@laptop.local>
Download mbox | patch
Permalink /patch/3982/
State Superseded
Headers show

Comments

Sean Farley - March 19, 2014, 1:11 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 9d9821e223edb30fa8dd173f31ea376f2b19dde6
# Parent  efbf15979538a1e32fb70bf89de7c60f8ead5909
repoview: add 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 tags. This is helpful if we have local tags
that might be hard to find once they are hidden.
Pierre-Yves David - March 19, 2014, 1:38 a.m.
On 03/18/2014 06:11 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 9d9821e223edb30fa8dd173f31ea376f2b19dde6
> # Parent  efbf15979538a1e32fb70bf89de7c60f8ead5909
> repoview: add 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 tags. This is helpful if we have local tags
> that might be hard to find once they are hidden.
>
> diff --git a/mercurial/repoview.py b/mercurial/repoview.py
> --- a/mercurial/repoview.py
> +++ b/mercurial/repoview.py
> @@ -33,10 +33,12 @@ 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())
> +        for t in repo.tags().values():
> +            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):

You cannot blindly use all tags here. That would make it impossible to 
prune changeset tagged in an hidden one.

Keeping changeset with -local- tag visible would make sense however.
Sean Farley - March 19, 2014, 1:56 a.m.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes:

> On 03/18/2014 06:11 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 9d9821e223edb30fa8dd173f31ea376f2b19dde6
>> # Parent  efbf15979538a1e32fb70bf89de7c60f8ead5909
>> repoview: add 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 tags. This is helpful if we have local tags
>> that might be hard to find once they are hidden.
>>
>> diff --git a/mercurial/repoview.py b/mercurial/repoview.py
>> --- a/mercurial/repoview.py
>> +++ b/mercurial/repoview.py
>> @@ -33,10 +33,12 @@ 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())
>> +        for t in repo.tags().values():
>> +            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):
>
> You cannot blindly use all tags here. That would make it impossible to 
> prune changeset tagged in an hidden one.
>
> Keeping changeset with -local- tag visible would make sense however.

Fair enough. Local tags is what I was envisioning for remote bookmarks
anyway.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -33,10 +33,12 @@  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())
+        for t in repo.tags().values():
+            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):