Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 26759:c0f475ac997e
exchange: support parameters in bundle specification strings
Sometimes a basic type string is not sufficient for representing the
contents of a bundle. Take bundle2 for example: future bundle2 files may
contain parts that today's bundle2 parser can't read. Another example is
stream clone data. These require clients to support specific
repository formats or they won't be able to read the written files. In
both scenarios, we need to describe additional metadata beyond the outer
container type. Furthermore, this metadata behaves more like an
unordered set, so an order-based declaration format (such as static
strings) is not sufficient.
We introduce support for "parameters" into the bundle specification
string. These are essentially key-value pairs that can be used to encode
additional metadata about the bundle.
Semicolons are used as the delimiter partially to increase similarity to
MIME parameter values (see RFC 2231) and because they are relatively
safe from the command line (although values will need quotes to avoid
interpretation as multiple shell commands). Alternatives considered were
spaces (a bit annoying to encode) and '&' (similar to URL query strings)
(which will do bad things in a shell if unquoted).
The parsing function now returns a dict of parsed parameters and
consumers have been updated accordingly.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 14 Oct 2015 17:00:34 -0700 |
parents | bde7ef23340d |
children | 7ce6fd705495 |
comparison
equal
deleted
inserted
replaced
26758:bde7ef23340d | 26759:c0f475ac997e |
---|---|
1242 if 'rev' in opts: | 1242 if 'rev' in opts: |
1243 revs = scmutil.revrange(repo, opts['rev']) | 1243 revs = scmutil.revrange(repo, opts['rev']) |
1244 | 1244 |
1245 bundletype = opts.get('type', 'bzip2').lower() | 1245 bundletype = opts.get('type', 'bzip2').lower() |
1246 try: | 1246 try: |
1247 bcompression, cgversion = exchange.parsebundlespec( | 1247 bcompression, cgversion, params = exchange.parsebundlespec( |
1248 repo, bundletype, strict=False) | 1248 repo, bundletype, strict=False) |
1249 except error.UnsupportedBundleSpecification as e: | 1249 except error.UnsupportedBundleSpecification as e: |
1250 raise error.Abort(str(e), | 1250 raise error.Abort(str(e), |
1251 hint=_('see "hg help bundle" for supported ' | 1251 hint=_('see "hg help bundle" for supported ' |
1252 'values for --type')) | 1252 'values for --type')) |