hidden: change _domainancestors() to _revealancestors()
This change makes the function actually reveal the ancestors by
removing them from the hidden set. This prepares for further
simplification.
Note that the function will now only reveal contiguous chains of
hidden revisions, but that's fine because we always pass it an
immediate child of any revision that should be revealed (or the
revision itself).
This doesn't seem to have much impact on "perfvolatilesets".
Before:
! obsolete
! wall 0.004672 comb 0.010000 user 0.010000 sys 0.000000 (best of 590)
! visible
! wall 0.008936 comb 0.010000 user 0.010000 sys 0.000000 (best of 322)
After:
! obsolete
! wall 0.004903 comb 0.000000 user 0.000000 sys 0.000000 (best of 535)
! visible
! wall 0.008913 comb 0.010000 user 0.010000 sys 0.000000 (best of 300)
--- a/mercurial/repoview.py Sat May 27 21:08:51 2017 -0700
+++ b/mercurial/repoview.py Sat May 27 21:17:06 2017 -0700
@@ -59,10 +59,12 @@
break
return blockers
-def _domainancestors(pfunc, revs, domain):
- """return ancestors of 'revs' within 'domain'
+def _revealancestors(pfunc, hidden, revs, domain):
+ """reveals contiguous chains of hidden ancestors of 'revs' within 'domain'
+ by removing them from 'hidden'
- pfunc(r): a funtion returning parent of 'r',
+ - hidden: the (preliminary) hidden revisions, to be updated
- revs: iterable of revnum,
- domain: consistent set of revnum.
@@ -85,16 +87,16 @@
If C, D, E and F are in the domain but B is not, A cannot be ((A) is an
ancestors disconnected subset disconnected of (C+D)).
- (Ancestors are returned inclusively)
+ (Ancestors are revealed inclusively, i.e. the elements in 'revs' are
+ also revealed)
"""
stack = list(revs)
- ancestors = set(stack)
+ hidden -= set(stack)
while stack:
for p in pfunc(stack.pop()):
- if p != nullrev and p in domain and p not in ancestors:
- ancestors.add(p)
+ if p != nullrev and p in domain and p in hidden:
+ hidden.remove(p)
stack.append(p)
- return ancestors
def computehidden(repo):
"""compute the set of hidden revision to filter
@@ -114,7 +116,9 @@
# changesets and remove those.
blockers |= (hidden & pinnedrevs(repo))
if blockers:
- hidden = hidden - _domainancestors(pfunc, blockers, mutable)
+ # don't modify possibly cached result of hideablerevs()
+ hidden = hidden.copy()
+ _revealancestors(pfunc, hidden, blockers, mutable)
return frozenset(hidden)
def computeunserved(repo):