Patchwork [7,of,8] hidden: make _revealancestors() reveal ancestors exclusively

login
register
mail settings
Submitter via Mercurial-devel
Date May 28, 2017, 6:15 a.m.
Message ID <55c2e0b946ab4b00c8cb.1495952135@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20972/
State Changes Requested
Headers show

Comments

via Mercurial-devel - May 28, 2017, 6:15 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1495951510 25200
#      Sat May 27 23:05:10 2017 -0700
# Node ID 55c2e0b946ab4b00c8cb481b92881d4c9ccb0707
# Parent  f8b3d943ff21a2b906f2806476a637aac93763c4
hidden: make _revealancestors() reveal ancestors exclusively

I think this seems more expected.
Pierre-Yves David - May 29, 2017, 4:50 p.m.
On 05/28/2017 08:15 AM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1495951510 25200
> #      Sat May 27 23:05:10 2017 -0700
> # Node ID 55c2e0b946ab4b00c8cb481b92881d4c9ccb0707
> # Parent  f8b3d943ff21a2b906f2806476a637aac93763c4
> hidden: make _revealancestors() reveal ancestors exclusively
>
> I think this seems more expected.

I don't find it especially better or more expected :-)
I -0 on that one but I do not care much.

>
> diff --git a/mercurial/repoview.py b/mercurial/repoview.py
> --- a/mercurial/repoview.py
> +++ b/mercurial/repoview.py
> @@ -52,11 +52,10 @@
>      - pfunc(r): a funtion returning parent of 'r',
>      - revs: iterable of revnum,
>
> -    (Ancestors are revealed inclusively, i.e. the elements in 'revs' are
> -    also revealed)
> +    (Ancestors are revealed exclusively, i.e. the elements in 'revs' are
> +    *not* revealed)
>      """
>      stack = list(revs)
> -    hidden -= set(stack)
>      while stack:
>          for p in pfunc(stack.pop()):
>              if p != nullrev and p in hidden:
> @@ -78,8 +77,7 @@
>          visible = set(mutable - hidden)
>          visible |= (hidden & anchorrevs(repo))
>          if visible:
> -            # don't modify possibly cached result of hideablerevs()
> -            hidden = hidden.copy()
> +            hidden = hidden - visible
>              _revealancestors(hidden, pfunc, visible)
>      return frozenset(hidden)
>
>

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -52,11 +52,10 @@ 
     - pfunc(r): a funtion returning parent of 'r',
     - revs: iterable of revnum,
 
-    (Ancestors are revealed inclusively, i.e. the elements in 'revs' are
-    also revealed)
+    (Ancestors are revealed exclusively, i.e. the elements in 'revs' are
+    *not* revealed)
     """
     stack = list(revs)
-    hidden -= set(stack)
     while stack:
         for p in pfunc(stack.pop()):
             if p != nullrev and p in hidden:
@@ -78,8 +77,7 @@ 
         visible = set(mutable - hidden)
         visible |= (hidden & anchorrevs(repo))
         if visible:
-            # don't modify possibly cached result of hideablerevs()
-            hidden = hidden.copy()
+            hidden = hidden - visible
             _revealancestors(hidden, pfunc, visible)
     return frozenset(hidden)