ancestor: return early from _lazyancestorsiter() when reached to stoprev
There's no need to empty the heap.
--- 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):