changeset 23759:f82173a90c2c

setdiscovery: factorize similar sampling code We are using full sampling of 'fullsamplesize' in both case. The only difference is the debug message. So we factorise the sampling code and put the message in an extra conditional. This is going to help making changes around the sampling logic. Such changes are needed to improve discovery performance on highly headed repository.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 06 Jan 2015 16:30:52 -0800
parents 4ef2f2fa8b8b
children 4ab66de46a96
files mercurial/setdiscovery.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -197,13 +197,11 @@
         if not undecided:
             break
 
-        if full:
-            ui.note(_("sampling from both directions\n"))
-            sample = _takefullsample(dag, undecided, size=fullsamplesize)
-            targetsize = fullsamplesize
-        elif common.hasbases():
-            # use cheapish initial sample
-            ui.debug("taking initial sample\n")
+        if full or common.hasbases():
+            if full:
+                ui.note(_("sampling from both directions\n"))
+            else:
+                ui.debug("taking initial sample\n")
             sample = _takefullsample(dag, undecided, size=fullsamplesize)
             targetsize = fullsamplesize
         else: