##// END OF EJS Templates
repoview: use a heap in _getstatichidden...
Pierre-Yves David -
r24616:72d34c5a default
parent child Browse files
Show More
@@ -6,7 +6,7 b''
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 import collections
9 import heapq
10 import copy
10 import copy
11 import error
11 import error
12 import phases
12 import phases
@@ -39,9 +39,13 b' def _getstatichidden(repo):'
39 actuallyhidden = {}
39 actuallyhidden = {}
40 getphase = repo._phasecache.phase
40 getphase = repo._phasecache.phase
41 getparentrevs = repo.changelog.parentrevs
41 getparentrevs = repo.changelog.parentrevs
42 queue = collections.deque((r, False) for r in repo.changelog.headrevs())
42 heap = [(-r, False) for r in repo.changelog.headrevs()]
43 while queue:
43 heapq.heapify(heap)
44 rev, blocked = queue.popleft()
44 heappop = heapq.heappop
45 heappush = heapq.heappush
46 while heap:
47 rev, blocked = heappop(heap)
48 rev = - rev
45 phase = getphase(repo, rev)
49 phase = getphase(repo, rev)
46 # Skip nodes which are public (guaranteed to not be hidden) and
50 # Skip nodes which are public (guaranteed to not be hidden) and
47 # nodes which have already been processed and won't be blocked by
51 # nodes which have already been processed and won't be blocked by
@@ -57,7 +61,7 b' def _getstatichidden(repo):'
57 blocked = True
61 blocked = True
58
62
59 for parent in (p for p in getparentrevs(rev) if p != nullrev):
63 for parent in (p for p in getparentrevs(rev) if p != nullrev):
60 queue.append((parent, blocked))
64 heappush(heap, (- parent, blocked))
61 return set(rev for rev, hidden in actuallyhidden.iteritems() if hidden)
65 return set(rev for rev, hidden in actuallyhidden.iteritems() if hidden)
62
66
63 def _getdynamicblockers(repo):
67 def _getdynamicblockers(repo):
General Comments 0
You need to be logged in to leave comments. Login now