[PATCH 2 of 6] ancestor: return early from _lazyancestorsiter() when reached to stoprev
Yuya Nishihara
yuya at tcha.org
Tue Sep 11 19:02:07 EDT 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1536583579 -32400
# Mon Sep 10 21:46:19 2018 +0900
# Node ID dd6a0955ec0081c6133ce8cf42d38914a8e305ab
# Parent 2989618d644ce4694a3288f8f20107f446703f66
ancestor: return early from _lazyancestorsiter() when reached to stoprev
There's no need to empty the heap.
diff --git a/mercurial/ancestor.py b/mercurial/ancestor.py
--- a/mercurial/ancestor.py
+++ b/mercurial/ancestor.py
@@ -281,12 +281,13 @@ def _lazyancestorsiter(parentrevs, initr
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):
More information about the Mercurial-devel
mailing list