obsdiscovery: enforce the config on the server too stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 02 Nov 2017 19:22:32 +0100
branchstable
changeset 3171 dbd340eafcb0
parent 3165 6ca44f334d47
child 3172 aed2cac9edc3
obsdiscovery: enforce the config on the server too Right now, setting 'experimental.evolution.obsdiscovery=no' disable obsolescence markers discovery on client only. The server still advertise discovery related capabilities. We now also honor the config on the server side.
CHANGELOG
hgext3rd/evolve/obsdiscovery.py
tests/test-wireproto.t
--- a/CHANGELOG	Thu Nov 02 00:45:28 2017 +0100
+++ b/CHANGELOG	Thu Nov 02 19:22:32 2017 +0100
@@ -1,6 +1,12 @@
 Changelog
 =========
 
+7.0.1 - in progress
+-------------------
+
+  * obsdiscovery: allow the config option to disable discovery server side
+    (it was previously only honored on the client side)
+
 7.0.0 -- 2017-10-23
 -------------------
 
--- a/hgext3rd/evolve/obsdiscovery.py	Thu Nov 02 00:45:28 2017 +0100
+++ b/hgext3rd/evolve/obsdiscovery.py	Thu Nov 02 19:22:32 2017 +0100
@@ -820,7 +820,8 @@
 def _obshash_capabilities(orig, repo, proto):
     """wrapper to advertise new capability"""
     caps = orig(repo, proto)
-    if obsolete.isenabled(repo, obsolete.exchangeopt):
+    if (obsolete.isenabled(repo, obsolete.exchangeopt)
+        and repo.ui.configbool('experimental', 'evolution.obsdiscovery', True)):
         caps = caps.split()
         caps.append('_evoext_obshash_0')
         caps.append('_evoext_obshash_1')
--- a/tests/test-wireproto.t	Thu Nov 02 00:45:28 2017 +0100
+++ b/tests/test-wireproto.t	Thu Nov 02 19:22:32 2017 +0100
@@ -187,4 +187,13 @@
   (controled by 'experimental.evolution.obsdiscovery' configuration)
   obsmarker-exchange: 258 bytes received
 
+And disable it server side too:
+
+  $ hg serve -R ../server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log  --config experimental.evolution.obsdiscovery=no
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ curl -s http://localhost:$HGPORT/?cmd=capabilities
+  _evoext_getbundle_obscommon batch branchmap bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Aobsmarkers%3DV0%2CV1%0Aphases%3Dheads%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps changegroupsubset compression=zstd,zlib getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-eol)
+  $ $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
+
   $ cd ..