discovery: explicitly use `undecided` for the children mapping
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 28 Feb 2019 01:49:10 +0100
changeset 41886 a05f0bbefdd9
parent 41885 5baf06d2bb41
child 41887 8c6ba2909155
discovery: explicitly use `undecided` for the children mapping Recent performance achievements makes the assumption that the `undecided` set is used for sampling. That assumption is always true in practice. We stop pretending that taking anything else would make sense and we directly use the `undecided` set from the object. This provides a more honest API.
mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py	Thu Feb 28 01:48:20 2019 +0100
+++ b/mercurial/setdiscovery.py	Thu Feb 28 01:49:10 2019 +0100
@@ -172,7 +172,7 @@
             return getrev(r)[5:6]
         return getparents
 
-    def _childrengetter(self, revs):
+    def _childrengetter(self):
 
         if self._childrenmap is not None:
             return self._childrenmap.__getitem__
@@ -184,6 +184,7 @@
         self._childrenmap = children = {}
 
         parentrevs = self._parentsgetter()
+        revs = self.undecided
 
         for rev in sorted(revs):
             # Always ensure revision has an entry so we don't need to worry
@@ -232,7 +233,7 @@
         # update from roots
         revsroots = set(repo.revs('roots(%ld)', revs))
 
-        childrenrevs = self._childrengetter(revs)
+        childrenrevs = self._childrengetter()
 
         _updatesample(revs, revsroots, sample, childrenrevs)
         assert sample