comparison mercurial/setdiscovery.py @ 46806:2b1b8f3e6510

setdiscovery: add a discovery.grow-sample.dynamic option The current discovery dynamically adapt to complex situations. This makes it quick and effective, but also harder so study the effects of other improvements in such complex situation. So we add a new option to control this too. Differential Revision: https://phab.mercurial-scm.org/D10233
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 17 Mar 2021 19:06:00 +0100
parents f165105400d0
children e7b4607d52e3
comparison
equal deleted inserted replaced
46805:f165105400d0 46806:2b1b8f3e6510
427 return ownheadhashes, True, srvheadhashes 427 return ownheadhashes, True, srvheadhashes
428 428
429 # full blown discovery 429 # full blown discovery
430 430
431 # if the server has a limit to its arguments size, we can't grow the sample. 431 # if the server has a limit to its arguments size, we can't grow the sample.
432 grow_sample = local.ui.configbool(b'devel', b'discovery.grow-sample') 432 configbool = local.ui.configbool
433 grow_sample = configbool(b'devel', b'discovery.grow-sample')
433 grow_sample = grow_sample and not remote.limitedarguments 434 grow_sample = grow_sample and not remote.limitedarguments
435
436 dynamic_sample = configbool(b'devel', b'discovery.grow-sample.dynamic')
437 hard_limit_sample = not (dynamic_sample or remote.limitedarguments)
434 438
435 randomize = ui.configbool(b'devel', b'discovery.randomize') 439 randomize = ui.configbool(b'devel', b'discovery.randomize')
436 disco = partialdiscovery( 440 disco = partialdiscovery(
437 local, ownheads, not grow_sample, randomize=randomize 441 local, ownheads, hard_limit_sample, randomize=randomize
438 ) 442 )
439 if initial_head_exchange: 443 if initial_head_exchange:
440 # treat remote heads (and maybe own heads) as a first implicit sample 444 # treat remote heads (and maybe own heads) as a first implicit sample
441 # response 445 # response
442 disco.addcommons(knownsrvheads) 446 disco.addcommons(knownsrvheads)