Mercurial > hg
changeset 41883:1f069f37e601
discovery: simplify the building of the children mapping
Since we only care about the revisions inside the set we are sampling, we can
use simpler code (and probably sightly faster).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 05 Mar 2019 15:39:54 +0100 |
parents | c98420914c10 |
children | d5e6ae6e8012 |
files | mercurial/setdiscovery.py |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/setdiscovery.py Tue Mar 05 15:52:14 2019 +0100 +++ b/mercurial/setdiscovery.py Tue Mar 05 15:39:54 2019 +0100 @@ -219,13 +219,13 @@ for rev in sorted(revs): # Always ensure revision has an entry so we don't need to worry # about missing keys. - children.setdefault(rev, []) - + children[rev] = [] for prev in parentrevs(rev): if prev == nullrev: continue - - children.setdefault(prev, []).append(rev) + c = children.get(prev) + if c is not None: + c.append(rev) _updatesample(revs, revsroots, sample, children.__getitem__) assert sample