From patchwork Tue May 30 20:29:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5,of,9,v2] hidden: pass revs to iterate into _consistencyblockers() From: via Mercurial-devel X-Patchwork-Id: 21079 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Tue, 30 May 2017 13:29:32 -0700 # HG changeset patch # User Martin von Zweigbergk # Date 1495950217 25200 # Sat May 27 22:43:37 2017 -0700 # Node ID fedf0f5eb5c446861cd0257a591e1fd131f53676 # Parent 77291870841002ceb0880874611a798ebf1967d8 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. diff --git a/mercurial/repoview.py b/mercurial/repoview.py --- a/mercurial/repoview.py +++ b/mercurial/repoview.py @@ -44,15 +44,14 @@ pinned.update(rev(t[0]) for t in tags.values() if t[0] in nodemap) return pinned -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.