mercurial/setdiscovery.py
changeset 46805 2b1b8f3e6510
parent 46804 f165105400d0
child 46841 e7b4607d52e3
--- a/mercurial/setdiscovery.py	Wed Mar 17 19:10:28 2021 +0100
+++ b/mercurial/setdiscovery.py	Wed Mar 17 19:06:00 2021 +0100
@@ -429,12 +429,16 @@
     # full blown discovery
 
     # if the server has a limit to its arguments size, we can't grow the sample.
-    grow_sample = local.ui.configbool(b'devel', b'discovery.grow-sample')
+    configbool = local.ui.configbool
+    grow_sample = configbool(b'devel', b'discovery.grow-sample')
     grow_sample = grow_sample and not remote.limitedarguments
 
+    dynamic_sample = configbool(b'devel', b'discovery.grow-sample.dynamic')
+    hard_limit_sample = not (dynamic_sample or remote.limitedarguments)
+
     randomize = ui.configbool(b'devel', b'discovery.randomize')
     disco = partialdiscovery(
-        local, ownheads, not grow_sample, randomize=randomize
+        local, ownheads, hard_limit_sample, randomize=randomize
     )
     if initial_head_exchange:
         # treat remote heads (and maybe own heads) as a first implicit sample