changeset 46804:f165105400d0

setdiscovery: rearrange code deciding if we will grow the sample The new code is clearer and will make the next update simpler. Differential Revision: https://phab.mercurial-scm.org/D10232
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 17 Mar 2021 19:10:28 +0100
parents 13d973690ecd
children 2b1b8f3e6510
files mercurial/setdiscovery.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/setdiscovery.py	Wed Mar 17 18:40:50 2021 +0100
+++ b/mercurial/setdiscovery.py	Wed Mar 17 19:10:28 2021 +0100
@@ -429,13 +429,12 @@
     # 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
+    grow_sample = grow_sample and not remote.limitedarguments
 
     randomize = ui.configbool(b'devel', b'discovery.randomize')
     disco = partialdiscovery(
-        local, ownheads, hard_limit_sample, randomize=randomize
+        local, ownheads, not grow_sample, randomize=randomize
     )
     if initial_head_exchange:
         # treat remote heads (and maybe own heads) as a first implicit sample
@@ -454,7 +453,7 @@
                 ui.debug(b"taking initial sample\n")
             samplefunc = disco.takefullsample
             targetsize = fullsamplesize
-            if not hard_limit_sample:
+            if grow_sample:
                 fullsamplesize = int(fullsamplesize * samplegrowth)
         else:
             # use even cheaper initial sample