Patchwork D9798: discovery: add a `devel', b'discovery.grow-sample`

login
register
mail settings
Submitter phabricator
Date Jan. 16, 2021, 12:26 a.m.
Message ID <differential-rev-PHID-DREV-bzferfrdnqjjherzrxsf-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48110/
State Superseded
Headers show

Comments

phabricator - Jan. 16, 2021, 12:26 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  That option make it possible to disable the "sample growing" behavior when doing
  analysis and comparison.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  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
@@ -418,9 +418,14 @@ 
 
     # 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')
     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
     # response
@@ -438,7 +443,7 @@ 
                 ui.debug(b"taking initial sample\n")
             samplefunc = disco.takefullsample
             targetsize = fullsamplesize
-            if not remote.limitedarguments:
+            if not hard_limit_sample:
                 fullsamplesize = int(fullsamplesize * samplegrowth)
         else:
             # use even cheaper initial sample
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -700,6 +700,13 @@ 
     b'debug.peer-request',
     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
 # deterministic. It is meant for integration tests.
 coreconfigitem(