changeset 49331:3840d16595cf

bundlespec: add a `overwrite` parameter to set_param This will open the way for the configuration value to yield in front of the explicit bundle type.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 17 May 2022 18:14:32 +0100
parents bf66f7a1e3f8
children 5bc3e76f919d
files mercurial/bundlecaches.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlecaches.py	Tue May 17 16:36:32 2022 +0100
+++ b/mercurial/bundlecaches.py	Tue May 17 18:14:32 2022 +0100
@@ -44,9 +44,12 @@
         # kept for Backward Compatibility concerns.
         return self.params
 
-    def set_param(self, key, value):
-        """overwrite a parameter value"""
-        self._explicit_params[key] = value
+    def set_param(self, key, value, overwrite=True):
+        """Set a bundle parameter value.
+
+        Will only overwrite if overwrite is true"""
+        if overwrite or key not in self._explicit_params:
+            self._explicit_params[key] = value
 
 
 # Maps bundle version human names to changegroup versions.