# HG changeset patch # User Pierre-Yves David # Date 1610753357 -3600 # Node ID 397e39ad0174046d4fd4e27761daf0472b1ba855 # Parent b1ae5383602dade8287b499e2d65d19ca5219e2c discovery: add a `devel', b'discovery.grow-sample` That option make it possible to disable the "sample growing" behavior when doing analysis and comparison. Differential Revision: https://phab.mercurial-scm.org/D9798 diff -r b1ae5383602d -r 397e39ad0174 mercurial/configitems.py --- a/mercurial/configitems.py Sat Jan 16 00:21:54 2021 +0100 +++ b/mercurial/configitems.py Sat Jan 16 00:29:17 2021 +0100 @@ -700,6 +700,13 @@ b'debug.peer-request', default=False, ) +# If discovery.grow-sample is False, the sample size used in set discovery will +# not be increased through the process +coreconfigitem( + b'devel', + b'discovery.grow-sample', + default=True, +) # If discovery.randomize is False, random sampling during discovery are # deterministic. It is meant for integration tests. coreconfigitem( diff -r b1ae5383602d -r 397e39ad0174 mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py Sat Jan 16 00:21:54 2021 +0100 +++ b/mercurial/setdiscovery.py Sat Jan 16 00:29:17 2021 +0100 @@ -418,9 +418,14 @@ # full blown discovery + # if the server has a limit to its arguments size, we can't grow the sample. + hard_limit_sample = remote.limitedarguments + grow_sample = local.ui.configbool(b'devel', b'discovery.grow-sample') + hard_limit_sample = hard_limit_sample and grow_sample + randomize = ui.configbool(b'devel', b'discovery.randomize') disco = partialdiscovery( - local, ownheads, remote.limitedarguments, randomize=randomize + local, ownheads, hard_limit_sample, randomize=randomize ) # treat remote heads (and maybe own heads) as a first implicit sample # response @@ -438,7 +443,7 @@ ui.debug(b"taking initial sample\n") samplefunc = disco.takefullsample targetsize = fullsamplesize - if not remote.limitedarguments: + if not hard_limit_sample: fullsamplesize = int(fullsamplesize * samplegrowth) else: # use even cheaper initial sample