# HG changeset patch # User Pierre-Yves David <pierre-yves.david@octobus.net> # Date 1687355613 -7200 # Wed Jun 21 15:53:33 2023 +0200 # Node ID 0913a49e020cace07558a5b8f3d21b5e3f391786 # Parent 40638610c6ee3edbf7cb8ce2c15216026ff8cf96 bundle-spec: add an official method to format a spec into a string This will be useful for automatic-clonebundles. diff --git a/mercurial/bundlecaches.py b/mercurial/bundlecaches.py --- a/mercurial/bundlecaches.py +++ b/mercurial/bundlecaches.py @@ -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 = {