setdiscovery: delay sample building calls to gather them in a single place
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 07 Jan 2015 09:30:06 -0800
changeset 23807 e97e363a7000
parent 23806 d6cbbe3baef0
child 23808 07d0f59e0ba7
setdiscovery: delay sample building calls to gather them in a single place Some of the logic around sample building is duplicated in the sample builders, it would clean up thing to extract it in the top function, but this requires all codes to be in the same place. This changeset mostly exists to make the next one more clear.
mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py	Tue Jan 06 16:32:23 2015 -0800
+++ b/mercurial/setdiscovery.py	Wed Jan 07 09:30:06 2015 -0800
@@ -198,13 +198,14 @@
                 ui.note(_("sampling from both directions\n"))
             else:
                 ui.debug("taking initial sample\n")
-            sample = _takefullsample(dag, undecided, size=fullsamplesize)
+            samplefunc = _takefullsample
             targetsize = fullsamplesize
         else:
             # use even cheaper initial sample
             ui.debug("taking quick initial sample\n")
-            sample = _takequicksample(dag, undecided, size=initialsamplesize)
+            samplefunc = _takequicksample
             targetsize = initialsamplesize
+        sample = samplefunc(dag, undecided, targetsize)
         sample = _limitsample(sample, targetsize)
 
         roundtrips += 1