# HG changeset patch # User Yuya Nishihara # Date 2017-06-18 08:16:02 # Node ID c7da57bbae96ebdc8435fb33b57a2e0f98f936b1 # Parent b9e2269aeff89ee5ff8665a8537d852d2dadab1a dagop: comment why revancestors() doesn't heapify input revs at once I wondered why we're doing this complicated stuff without noticing the input revs may be iterated lazily in descending order. c1f666e27345 showed why. diff --git a/mercurial/dagop.py b/mercurial/dagop.py --- a/mercurial/dagop.py +++ b/mercurial/dagop.py @@ -26,6 +26,9 @@ def _genrevancestors(repo, revs, followf else: cut = None cl = repo.changelog + + # load input revs lazily to heap so earlier revisions can be yielded + # without fully computing the input revs revs.sort(reverse=True) irevs = iter(revs) h = []