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).
--- 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