[PATCH 2 of 7] dagop: comment why revancestors() doesn't heapify input revs at once
Yuya Nishihara
yuya at tcha.org
Thu Jun 22 15:52:15 UTC 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1497773762 -32400
# Sun Jun 18 17:16:02 2017 +0900
# Node ID 2288ecd79fca3e8ac9a6211b81410c8d78271add
# Parent a8dd4bd0604af65ee06cd942e9af4b7971725f43
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 = []
More information about the Mercurial-devel
mailing list