diff mercurial/commands.py @ 49325:bf66f7a1e3f8

bundlespec: merge the contentopts and params dictionnary They are content using the same keys. Using differents object for access open the gates for confusion in the code using them (this is already the case). So we start fusing their usages to make the parameters more useful. More work will be needed to make them really useful, but the first step is here: not throwing the value away. However this is still not making the previously introduced test useful because currently, the default config value overwrite the one from the bundlespec. We will fix this in the coming changesets.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 17 May 2022 16:36:32 +0100
parents 2e726c934fcd
children 5bc3e76f919d
line wrap: on
line diff
--- a/mercurial/commands.py	Wed May 25 03:16:53 2022 +0200
+++ b/mercurial/commands.py	Tue May 17 16:36:32 2022 +0100
@@ -1570,7 +1570,7 @@
             pycompat.bytestr(e),
             hint=_(b"see 'hg help bundlespec' for supported values for --type"),
         )
-    cgversion = bundlespec.contentopts[b"cg.version"]
+    cgversion = bundlespec.params[b"cg.version"]
 
     # Packed bundles are a pseudo bundle format for now.
     if cgversion == b's1':
@@ -1680,14 +1680,12 @@
     # Bundling of obsmarker and phases is optional as not all clients
     # support the necessary features.
     cfg = ui.configbool
-    contentopts = {
-        b'obsolescence': cfg(b'experimental', b'evolution.bundle-obsmarker'),
-        b'obsolescence-mandatory': cfg(
-            b'experimental', b'evolution.bundle-obsmarker:mandatory'
-        ),
-        b'phases': cfg(b'experimental', b'bundle-phases'),
-    }
-    bundlespec.contentopts.update(contentopts)
+    obsolescence_cfg = cfg(b'experimental', b'evolution.bundle-obsmarker')
+    bundlespec.set_param(b'obsolescence', obsolescence_cfg)
+    obs_mand_cfg = cfg(b'experimental', b'evolution.bundle-obsmarker:mandatory')
+    bundlespec.set_param(b'obsolescence-mandatory', obs_mand_cfg)
+    phases_cfg = cfg(b'experimental', b'bundle-phases')
+    bundlespec.set_param(b'phases', phases_cfg)
 
     bundle2.writenewbundle(
         ui,
@@ -1696,7 +1694,7 @@
         fname,
         bversion,
         outgoing,
-        bundlespec.contentopts,
+        bundlespec.params,
         compression=bcompression,
         compopts=compopts,
     )