##// END OF EJS Templates
repoview: simplify process in _getstatichidden...
Pierre-Yves David -
r24617:f76595f6 default
parent child Browse files
Show More
@@ -34,35 +34,30 b' def _getstatichidden(repo):'
34 34
35 35 """
36 36 assert not repo.changelog.filteredrevs
37 hideable = hideablerevs(repo)
38 if hideable:
39 actuallyhidden = {}
37 hidden = set(hideablerevs(repo))
38 if hidden:
40 39 getphase = repo._phasecache.phase
41 40 getparentrevs = repo.changelog.parentrevs
42 heap = [(-r, False) for r in repo.changelog.headrevs()]
41 heap = [-r for r in repo.changelog.headrevs()]
43 42 heapq.heapify(heap)
44 43 heappop = heapq.heappop
45 44 heappush = heapq.heappush
46 45 while heap:
47 rev, blocked = heappop(heap)
48 rev = - rev
49 phase = getphase(repo, rev)
50 # Skip nodes which are public (guaranteed to not be hidden) and
51 # nodes which have already been processed and won't be blocked by
52 # the previous node.
53 if phase == 0 or (not blocked and rev in actuallyhidden):
46 rev = -heappop(heap)
47 # Skip nodes which are public (guaranteed to not be hidden)
48 if not getphase(repo, rev):
54 49 continue
55 if rev in hideable:
56 if blocked:
57 actuallyhidden[rev] = False
58 else:
59 actuallyhidden.setdefault(rev, True)
60 else:
61 blocked = True
62
63 for parent in (p for p in getparentrevs(rev) if p != nullrev):
64 heappush(heap, (- parent, blocked))
65 return set(rev for rev, hidden in actuallyhidden.iteritems() if hidden)
50 # All children have been processed so at that point, if no children
51 # removed 'rev' from the 'hidden' set, 'rev' is going to be hidden.
52 blocker = rev not in hidden
53 for parent in getparentrevs(rev):
54 if parent == nullrev:
55 continue
56 if blocker:
57 # If visible, ensure parent will be visible too
58 hidden.discard(parent)
59 heappush(heap, -parent)
60 return hidden
66 61
67 62 def _getdynamicblockers(repo):
68 63 """Non-cacheable revisions blocking hidden changesets from being filtered.
General Comments 0
You need to be logged in to leave comments. Login now