Patchwork [5,of,8] hidden: pass revs to iterate into _consistencyblockers()

login
register
mail settings
Submitter via Mercurial-devel
Date May 28, 2017, 6:15 a.m.
Message ID <8b91ef8f7f051165c098.1495952133@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20970/
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 1495950217 25200
#      Sat May 27 22:43:37 2017 -0700
# Node ID 8b91ef8f7f051165c098f3ebfc871e90afada070
# Parent  dd4f27063e5a2c7350509ba99e28b7c9b810acac
hidden: pass revs to iterate into _consistencyblockers()

Instead of passing the domain into _consistencyblockers() and having
the function calculate the set of revisions to iterate over, let the
caller do it. This is just a minor refactoring to make future changes
simpler.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -44,15 +44,14 @@ 
         anchors.update(rev(t[0]) for t in tags.values() if t[0] in nodemap)
     return anchors
 
-def _consistencyblocker(pfunc, hideable, domain):
+def _consistencyblocker(pfunc, hideable, revs):
     """return non-hideable changeset blocking hideable one
 
     For consistency, we cannot actually hide a changeset if one of it children
     are visible, this function find such children.
     """
-    others = domain - hideable
     blockers = set()
-    for r in others:
+    for r in revs:
         for p in pfunc(r):
             if p != nullrev and p in hideable:
                 blockers.add(r)
@@ -90,7 +89,8 @@ 
         mutablephases = (phases.draft, phases.secret)
         mutable = repo._phasecache.getrevset(repo, mutablephases)
 
-        blockers = _consistencyblocker(pfunc, hidden, mutable)
+        visible = mutable - hidden
+        blockers = _consistencyblocker(pfunc, hidden, visible)
 
         # check if we have wd parents, bookmarks or tags pointing to hidden
         # changesets and remove those.