comparison mercurial/setdiscovery.py @ 41882:c98420914c10

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 05 Mar 2019 15:52:14 +0100
parents e514799e4e07
children 1f069f37e601
comparison
equal deleted inserted replaced
41881:e514799e4e07 41882:c98420914c10
214 # Because this function can be called multiple times during discovery, 214 # Because this function can be called multiple times during discovery,
215 # we may still perform redundant work and there is room to optimize 215 # we may still perform redundant work and there is room to optimize
216 # this by keeping a persistent cache of children across invocations. 216 # this by keeping a persistent cache of children across invocations.
217 children = {} 217 children = {}
218 218
219 for rev in repo.changelog.revs(start=min(revsroots)): 219 for rev in sorted(revs):
220 # Always ensure revision has an entry so we don't need to worry 220 # Always ensure revision has an entry so we don't need to worry
221 # about missing keys. 221 # about missing keys.
222 children.setdefault(rev, []) 222 children.setdefault(rev, [])
223 223
224 for prev in parentrevs(rev): 224 for prev in parentrevs(rev):