Patchwork [9,of,9,"] discovery: explicitly use `undecided` for the children mapping

login
register
mail settings
Submitter Pierre-Yves David
Date March 5, 2019, 5:39 p.m.
Message ID <dc1719ac0f255e6b243d.1551807560@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39084/
State Accepted
Headers show

Comments

Pierre-Yves David - March 5, 2019, 5:39 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1551314950 -3600
#      Thu Feb 28 01:49:10 2019 +0100
# Node ID dc1719ac0f255e6b243d06b94007664908c3976e
# Parent  6127533daac7b331ba980d70040d55ee938ce106
# EXP-Topic discovery-speedup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r dc1719ac0f25
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.

Patch

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -172,7 +172,7 @@  class partialdiscovery(object):
             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 @@  class partialdiscovery(object):
         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 @@  class partialdiscovery(object):
         # update from roots
         revsroots = set(repo.revs('roots(%ld)', revs))
 
-        childrenrevs = self._childrengetter(revs)
+        childrenrevs = self._childrengetter()
 
         _updatesample(revs, revsroots, sample, childrenrevs)
         assert sample