Skip to content
Snippets Groups Projects
Commit 397e39ad authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

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
parent b1ae5383
No related branches found
No related tags found
No related merge requests found
...@@ -700,6 +700,13 @@ ...@@ -700,6 +700,13 @@
b'debug.peer-request', b'debug.peer-request',
default=False, 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 # If discovery.randomize is False, random sampling during discovery are
# deterministic. It is meant for integration tests. # deterministic. It is meant for integration tests.
coreconfigitem( coreconfigitem(
......
...@@ -418,5 +418,10 @@ ...@@ -418,5 +418,10 @@
# full blown discovery # 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') randomize = ui.configbool(b'devel', b'discovery.randomize')
disco = partialdiscovery( disco = partialdiscovery(
...@@ -421,6 +426,6 @@ ...@@ -421,6 +426,6 @@
randomize = ui.configbool(b'devel', b'discovery.randomize') randomize = ui.configbool(b'devel', b'discovery.randomize')
disco = partialdiscovery( 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 # treat remote heads (and maybe own heads) as a first implicit sample
# response # response
...@@ -438,7 +443,7 @@ ...@@ -438,7 +443,7 @@
ui.debug(b"taking initial sample\n") ui.debug(b"taking initial sample\n")
samplefunc = disco.takefullsample samplefunc = disco.takefullsample
targetsize = fullsamplesize targetsize = fullsamplesize
if not remote.limitedarguments: if not hard_limit_sample:
fullsamplesize = int(fullsamplesize * samplegrowth) fullsamplesize = int(fullsamplesize * samplegrowth)
else: else:
# use even cheaper initial sample # use even cheaper initial sample
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment