mercurial/revset.py
changeset 24939 85544a52ee84
parent 24938 6db8074f9150
child 24940 6b54f749659b
--- a/mercurial/revset.py	Wed May 06 11:29:09 2015 -0700
+++ b/mercurial/revset.py	Wed Mar 26 16:21:30 2014 -0700
@@ -26,22 +26,24 @@
 
     def iterate():
         revs.sort(reverse=True)
-        revqueue = util.deque(revs)
-        if not revqueue:
+        irevs = iter(revs)
+        h = []
+        try:
+            inputrev = irevs.next()
+            heapq.heappush(h, -inputrev)
+        except StopIteration:
             return
 
-        h = []
-        inputrev = revqueue.popleft()
-        heapq.heappush(h, -inputrev)
-
         seen = set()
         while h:
             current = -heapq.heappop(h)
             if current not in seen:
                 if current == inputrev:
-                    if revqueue:
-                        inputrev = revqueue.popleft()
+                    try:
+                        inputrev = irevs.next()
                         heapq.heappush(h, -inputrev)
+                    except StopIteration:
+                        pass
                 seen.add(current)
                 yield current
                 for parent in cl.parentrevs(current)[:cut]: