Patchwork D10232: setdiscovery: rearrange code deciding if we will grow the sample

login
register
mail settings
Submitter phabricator
Date March 17, 2021, 10:16 p.m.
Message ID <differential-rev-PHID-DREV-y5fib43jkhl4tjjfbiz2-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48547/
State Superseded
Headers show

Comments

phabricator - March 17, 2021, 10:16 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The new code is clearer and will make the next update simpler.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10232

AFFECTED FILES
  mercurial/setdiscovery.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -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