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):