# HG changeset patch # User Pierre-Yves David # Date 2019-03-05 14:52:14 # Node ID c98420914c109c6131a2aef57d6a2bdfdda40d7b # Parent e514799e4e0784ce273fde4ff524b17b4c296906 discovery: simply walk the undecided revs when building the children mapping The sampling only care about revisions in the undecided set, so building children relationship within this set is sufficient. The set of undecided changesets can be much smaller than the full span from its smallest item to the tip of the repository. This restriction can significantly speed up operations in some cases. For example, on our private pathological case, this speeds things up from about 53 seconds to about 7.5 seconds. diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -216,7 +216,7 @@ class partialdiscovery(object): # this by keeping a persistent cache of children across invocations. children = {} - for rev in repo.changelog.revs(start=min(revsroots)): + for rev in sorted(revs): # Always ensure revision has an entry so we don't need to worry # about missing keys. children.setdefault(rev, [])