changeset 39534:fd9029d36c41

ancestor: return early from _lazyancestorsiter() when reached to stoprev There's no need to empty the heap.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 10 Sep 2018 21:46:19 +0900
parents f6bcb4f9cd3c
children b9ee9c2e10dd
files mercurial/ancestor.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ancestor.py	Tue Sep 11 22:38:32 2018 +0900
+++ b/mercurial/ancestor.py	Mon Sep 10 21:46:19 2018 +0900
@@ -281,12 +281,13 @@
 
     while visit:
         current = -nextitem(visit)
-        if current >= stoprev:
-            yield current
-            for parent in parentrevs(current):
-                if parent not in seen:
-                    schedule(visit, -parent)
-                    see(parent)
+        if current < stoprev:
+            break
+        yield current
+        for parent in parentrevs(current):
+            if parent not in seen:
+                schedule(visit, -parent)
+                see(parent)
 
 class lazyancestors(object):
     def __init__(self, pfunc, revs, stoprev=0, inclusive=False):