The current discovery dynamically adapt to complex situations. This make is quick
effective, but also harder so study the effect of other improvements in such
complex situation.
So we add a new option to control this too.
hg-reviewers |
The current discovery dynamically adapt to complex situations. This make is quick
effective, but also harder so study the effect of other improvements in such
complex situation.
So we add a new option to control this too.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/configitems.py (8 lines) | |||
M | mercurial/debugcommands.py (6 lines) | |||
M | mercurial/setdiscovery.py (8 lines) |
) | ) | ||||
# If discovery.grow-sample is False, the sample size used in set discovery will | # If discovery.grow-sample is False, the sample size used in set discovery will | ||||
# not be increased through the process | # not be increased through the process | ||||
coreconfigitem( | coreconfigitem( | ||||
b'devel', | b'devel', | ||||
b'discovery.grow-sample', | b'discovery.grow-sample', | ||||
default=True, | default=True, | ||||
) | ) | ||||
# When discovery.grow-sample.dynamic is True, the default, the sample size is | |||||
# adapted to the shape of the undecided set (it is set to the max of: | |||||
# <target-size>, len(roots(undecided)), len(heads(undecided) | |||||
coreconfigitem( | |||||
b'devel', | |||||
b'discovery.grow-sample.dynamic', | |||||
default=True, | |||||
) | |||||
# discovery.grow-sample.rate control the rate at which the sample grow | # discovery.grow-sample.rate control the rate at which the sample grow | ||||
coreconfigitem( | coreconfigitem( | ||||
b'devel', | b'devel', | ||||
b'discovery.grow-sample.rate', | b'discovery.grow-sample.rate', | ||||
default=1.05, | default=1.05, | ||||
) | ) | ||||
# 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. |
If False, the discovery will not start with | If False, the discovery will not start with | ||||
remote head fetching and local head querying. | remote head fetching and local head querying. | ||||
* devel.discovery.grow-sample=True | * devel.discovery.grow-sample=True | ||||
If False, the sample size used in set discovery will not be increased | If False, the sample size used in set discovery will not be increased | ||||
through the process | through the process | ||||
* devel.discovery.grow-sample.dynamic=True | |||||
When discovery.grow-sample.dynamic is True, the default, the sample size is | |||||
adapted to the shape of the undecided set (it is set to the max of: | |||||
<target-size>, len(roots(undecided)), len(heads(undecided) | |||||
* devel.discovery.grow-sample.rate=1.05 | * devel.discovery.grow-sample.rate=1.05 | ||||
the rate at which the sample grow | the rate at which the sample grow | ||||
* devel.discovery.randomize=True | * devel.discovery.randomize=True | ||||
If andom sampling during discovery are deterministic. It is meant for | If andom sampling during discovery are deterministic. It is meant for | ||||
integration tests. | integration tests. |
if len(sample) == len(ownheads) and all(yesno): | if len(sample) == len(ownheads) and all(yesno): | ||||
ui.note(_(b"all local changesets known remotely\n")) | ui.note(_(b"all local changesets known remotely\n")) | ||||
ownheadhashes = [clnode(r) for r in ownheads] | ownheadhashes = [clnode(r) for r in ownheads] | ||||
return ownheadhashes, True, srvheadhashes | return ownheadhashes, True, srvheadhashes | ||||
# full blown discovery | # full blown discovery | ||||
# if the server has a limit to its arguments size, we can't grow the sample. | # if the server has a limit to its arguments size, we can't grow the sample. | ||||
grow_sample = local.ui.configbool(b'devel', b'discovery.grow-sample') | configbool = local.ui.configbool | ||||
grow_sample = configbool(b'devel', b'discovery.grow-sample') | |||||
grow_sample = grow_sample and not remote.limitedarguments | grow_sample = grow_sample and not remote.limitedarguments | ||||
dynamic_sample = configbool(b'devel', b'discovery.grow-sample.dynamic') | |||||
hard_limit_sample = not (dynamic_sample or remote.limitedarguments) | |||||
randomize = ui.configbool(b'devel', b'discovery.randomize') | randomize = ui.configbool(b'devel', b'discovery.randomize') | ||||
disco = partialdiscovery( | disco = partialdiscovery( | ||||
local, ownheads, not grow_sample, randomize=randomize | local, ownheads, hard_limit_sample, randomize=randomize | ||||
) | ) | ||||
if initial_head_exchange: | if initial_head_exchange: | ||||
# 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 | ||||
disco.addcommons(knownsrvheads) | disco.addcommons(knownsrvheads) | ||||
disco.addinfo(zip(sample, yesno)) | disco.addinfo(zip(sample, yesno)) | ||||
full = not initial_head_exchange | full = not initial_head_exchange |