##// END OF EJS Templates
revset: use an iterator instead of a dequeue in ancestors()...
Pierre-Yves David -
r24939:85544a52 default
parent child Browse files
Show More
@@ -26,22 +26,24 b' def _revancestors(repo, revs, followfirs'
26 26
27 27 def iterate():
28 28 revs.sort(reverse=True)
29 revqueue = util.deque(revs)
30 if not revqueue:
29 irevs = iter(revs)
30 h = []
31 try:
32 inputrev = irevs.next()
33 heapq.heappush(h, -inputrev)
34 except StopIteration:
31 35 return
32 36
33 h = []
34 inputrev = revqueue.popleft()
35 heapq.heappush(h, -inputrev)
36
37 37 seen = set()
38 38 while h:
39 39 current = -heapq.heappop(h)
40 40 if current not in seen:
41 41 if current == inputrev:
42 if revqueue:
43 inputrev = revqueue.popleft()
42 try:
43 inputrev = irevs.next()
44 44 heapq.heappush(h, -inputrev)
45 except StopIteration:
46 pass
45 47 seen.add(current)
46 48 yield current
47 49 for parent in cl.parentrevs(current)[:cut]:
General Comments 0
You need to be logged in to leave comments. Login now