##// 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 def iterate():
27 def iterate():
28 revs.sort(reverse=True)
28 revs.sort(reverse=True)
29 revqueue = util.deque(revs)
29 irevs = iter(revs)
30 if not revqueue:
30 h = []
31 try:
32 inputrev = irevs.next()
33 heapq.heappush(h, -inputrev)
34 except StopIteration:
31 return
35 return
32
36
33 h = []
34 inputrev = revqueue.popleft()
35 heapq.heappush(h, -inputrev)
36
37 seen = set()
37 seen = set()
38 while h:
38 while h:
39 current = -heapq.heappop(h)
39 current = -heapq.heappop(h)
40 if current not in seen:
40 if current not in seen:
41 if current == inputrev:
41 if current == inputrev:
42 if revqueue:
42 try:
43 inputrev = revqueue.popleft()
43 inputrev = irevs.next()
44 heapq.heappush(h, -inputrev)
44 heapq.heappush(h, -inputrev)
45 except StopIteration:
46 pass
45 seen.add(current)
47 seen.add(current)
46 yield current
48 yield current
47 for parent in cl.parentrevs(current)[:cut]:
49 for parent in cl.parentrevs(current)[:cut]:
General Comments 0
You need to be logged in to leave comments. Login now