Mercurial > public > mercurial-scm > hg
comparison mercurial/bundlecaches.py @ 50709: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 | a41eeb877d07 |
children | c4aab3661f25 eac84af0c8cc |
comparison
equal
deleted
inserted
replaced
50708:40638610c6ee | 50709:0913a49e020c |
---|---|
86 """Set a bundle parameter value. | 86 """Set a bundle parameter value. |
87 | 87 |
88 Will only overwrite if overwrite is true""" | 88 Will only overwrite if overwrite is true""" |
89 if overwrite or key not in self._explicit_params: | 89 if overwrite or key not in self._explicit_params: |
90 self._explicit_params[key] = value | 90 self._explicit_params[key] = value |
91 | |
92 def as_spec(self): | |
93 parts = [b"%s-%s" % (self.compression, self.version)] | |
94 for param in sorted(self._explicit_params.items()): | |
95 parts.append(b'%s=%s' % param) | |
96 return b';'.join(parts) | |
91 | 97 |
92 | 98 |
93 # Maps bundle version human names to changegroup versions. | 99 # Maps bundle version human names to changegroup versions. |
94 _bundlespeccgversions = { | 100 _bundlespeccgversions = { |
95 b'v1': b'01', | 101 b'v1': b'01', |