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