changeset 50712:0913a49e020c

bundle-spec: add an official method to format a spec into a string This will be useful for automatic-clonebundles.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 21 Jun 2023 15:53:33 +0200
parents 40638610c6ee
children ddc55fb220ba
files mercurial/bundlecaches.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlecaches.py	Mon Jun 19 18:15:35 2023 +0200
+++ b/mercurial/bundlecaches.py	Wed Jun 21 15:53:33 2023 +0200
@@ -89,6 +89,12 @@
         if overwrite or key not in self._explicit_params:
             self._explicit_params[key] = value
 
+    def as_spec(self):
+        parts = [b"%s-%s" % (self.compression, self.version)]
+        for param in sorted(self._explicit_params.items()):
+            parts.append(b'%s=%s' % param)
+        return b';'.join(parts)
+
 
 # Maps bundle version human names to changegroup versions.
 _bundlespeccgversions = {