##// END OF EJS Templates
_revancestors: use 'next' to remove the verbose try except clauses...
Pierre-Yves David -
r25143:91c49621 default
parent child Browse files
Show More
@@ -28,21 +28,18 def _revancestors(repo, revs, followfirs
28 revs.sort(reverse=True)
28 revs.sort(reverse=True)
29 irevs = iter(revs)
29 irevs = iter(revs)
30 h = []
30 h = []
31 try:
31
32 inputrev = irevs.next()
32 inputrev = next(irevs, None)
33 if inputrev is not None:
33 heapq.heappush(h, -inputrev)
34 heapq.heappush(h, -inputrev)
34 except StopIteration:
35 return
36
35
37 seen = set()
36 seen = set()
38 while h:
37 while h:
39 current = -heapq.heappop(h)
38 current = -heapq.heappop(h)
40 if current == inputrev:
39 if current == inputrev:
41 try:
40 inputrev = next(irevs, None)
42 inputrev = irevs.next()
41 if inputrev is not None:
43 heapq.heappush(h, -inputrev)
42 heapq.heappush(h, -inputrev)
44 except StopIteration:
45 pass
46 if current not in seen:
43 if current not in seen:
47 seen.add(current)
44 seen.add(current)
48 yield current
45 yield current
General Comments 0
You need to be logged in to leave comments. Login now