diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -256,7 +256,8 @@ def findcommonheads(ui, local, remote, initialsamplesize=100, fullsamplesize=200, abortwhenunrelated=True, - ancestorsof=None): + ancestorsof=None, + samplegrowth=1.05): '''Return a tuple (common, anyincoming, remoteheads) used to identify missing nodes from or in remote. ''' @@ -389,6 +390,8 @@ def findcommonheads(ui, local, remote, ui.debug("taking initial sample\n") samplefunc = disco.takefullsample targetsize = fullsamplesize + if not remote.limitedarguments: + fullsamplesize = int(fullsamplesize * samplegrowth) else: # use even cheaper initial sample ui.debug("taking quick initial sample\n") diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t --- a/tests/test-setdiscovery.t +++ b/tests/test-setdiscovery.t @@ -980,10 +980,10 @@ One with >200 heads. We now switch to se query 3; still undecided: 980, sample size is: 200 sampling from both directions searching: 4 queries - query 4; still undecided: \d+, sample size is: 200 (re) + query 4; still undecided: 435, sample size is: 210 sampling from both directions searching: 5 queries - query 5; still undecided: 195, sample size is: 195 + query 5; still undecided: 185, sample size is: 185 5 total queries in *.????s (glob) elapsed time: * seconds (glob) heads summary: