# HG changeset patch # User Yuya Nishihara # Date 1536583579 -32400 # Node ID fd9029d36c41e77002ca9647827c11b86f896d8c # Parent f6bcb4f9cd3cd0b216fb96635c6c12a7bf10c3d2 ancestor: return early from _lazyancestorsiter() when reached to stoprev There's no need to empty the heap. diff -r f6bcb4f9cd3c -r fd9029d36c41 mercurial/ancestor.py --- 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):