# HG changeset patch # User Pierre-Yves David # Date 1420651806 28800 # Node ID e97e363a7000817dcad4d05caddfbbec44dfc897 # Parent d6cbbe3baef0f8c9435675b83c09eb3bba764d88 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. diff -r d6cbbe3baef0 -r e97e363a7000 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