Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 26760:a18ee7da38c2
exchange: parse requirements from stream clone specification string
Stream clone bundles can only be consumed if the consumer supports the
exact format requirements that were present on the producer.
This patch adds support for encoding and verifying the format
requirements on the bundle specification string for a stream clone
bundle are supported by the local repository. If they aren't, we raise
an UnsupportedBundleSpecification, just like we do when an unknown
compression or bundle type is encountered.
The impetus for this patch is so the clone bundles manifest can
advertise stream clone bundles and so clients can filter out stream
clones with unsupported format requirements. e.g. a stream clone
produced with the not-yet-invented "revlogv2" format will be ignored by
clients that only support "revlogv1."
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 17 Oct 2015 10:26:34 -0700 |
parents | c0f475ac997e |
children | 8270ee357dd9 |
comparison
equal
deleted
inserted
replaced
26759:c0f475ac997e | 26760:a18ee7da38c2 |
---|---|
121 compression = 'bzip2' | 121 compression = 'bzip2' |
122 version = spec | 122 version = spec |
123 else: | 123 else: |
124 raise error.UnsupportedBundleSpecification( | 124 raise error.UnsupportedBundleSpecification( |
125 _('%s is not a recognized bundle specification') % spec) | 125 _('%s is not a recognized bundle specification') % spec) |
126 | |
127 # The specification for packed1 can optionally declare the data formats | |
128 # required to apply it. If we see this metadata, compare against what the | |
129 # repo supports and error if the bundle isn't compatible. | |
130 if version == 'packed1' and 'requirements' in params: | |
131 requirements = set(params['requirements'].split(',')) | |
132 missingreqs = requirements - repo.supportedformats | |
133 if missingreqs: | |
134 raise error.UnsupportedBundleSpecification( | |
135 _('missing support for repository features: %s') % | |
136 ', '.join(sorted(missingreqs))) | |
126 | 137 |
127 if not externalnames: | 138 if not externalnames: |
128 compression = _bundlespeccompressions[compression] | 139 compression = _bundlespeccompressions[compression] |
129 version = _bundlespeccgversions[version] | 140 version = _bundlespeccgversions[version] |
130 return compression, version, params | 141 return compression, version, params |