That option make it possible to disable the "sample growing" behavior when doing
analysis and comparison.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
( )
That option make it possible to disable the "sample growing" behavior when doing
analysis and comparison.
| No Linters Available |
| No Unit Test Coverage |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/configitems.py (7 lines) | |||
| M | mercurial/setdiscovery.py (9 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| f1b1a4f5e1e0 | accd425e126b | Pierre-Yves David | Jan 15 2021, 6:29 PM |
| b'debug.repo-filters', | b'debug.repo-filters', | ||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| coreconfigitem( | coreconfigitem( | ||||
| b'devel', | b'devel', | ||||
| 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( | ||||
| b'devel', | b'devel', | ||||
| b'discovery.randomize', | b'discovery.randomize', | ||||
| default=True, | default=True, | ||||
| ) | ) | ||||
| _registerdiffopts(section=b'diff') | _registerdiffopts(section=b'diff') | ||||
| 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. | |||||
| 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( | ||||
| 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 | ||||
| disco.addcommons(knownsrvheads) | disco.addcommons(knownsrvheads) | ||||
| disco.addinfo(zip(sample, yesno)) | disco.addinfo(zip(sample, yesno)) | ||||
| full = False | full = False | ||||
| progress = ui.makeprogress(_(b'searching'), unit=_(b'queries')) | progress = ui.makeprogress(_(b'searching'), unit=_(b'queries')) | ||||
| while not disco.iscomplete(): | while not disco.iscomplete(): | ||||
| if full or disco.hasinfo(): | if full or disco.hasinfo(): | ||||
| if full: | if full: | ||||
| ui.note(_(b"sampling from both directions\n")) | ui.note(_(b"sampling from both directions\n")) | ||||
| else: | else: | ||||
| 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 | ||||
| ui.debug(b"taking quick initial sample\n") | ui.debug(b"taking quick initial sample\n") | ||||
| samplefunc = disco.takequicksample | samplefunc = disco.takequicksample | ||||
| targetsize = initialsamplesize | targetsize = initialsamplesize | ||||
| sample = samplefunc(ownheads, targetsize) | sample = samplefunc(ownheads, targetsize) | ||||