exchange: support preserving external names when parsing bundle specs
This will be needed to make client-side preferences work easier.
--- a/mercurial/exchange.py Tue Oct 13 10:59:41 2015 -0700
+++ b/mercurial/exchange.py Tue Oct 13 12:29:50 2015 -0700
@@ -28,7 +28,7 @@
'bundle2': '02', #legacy
}
-def parsebundlespec(repo, spec, strict=True):
+def parsebundlespec(repo, spec, strict=True, externalnames=False):
"""Parse a bundle string specification into parts.
Bundle specifications denote a well-defined bundle/exchange format.
@@ -46,6 +46,9 @@
If ``strict`` is True (the default) <compression> is required. Otherwise,
it is optional.
+ If ``externalnames`` is False (the default), the human-centric names will
+ be converted to their internal representation.
+
Returns a 2-tuple of (compression, version). Compression will be ``None``
if not in strict mode and a compression isn't defined.
@@ -90,8 +93,9 @@
raise error.UnsupportedBundleSpecification(
_('%s is not a recognized bundle specification') % spec)
- compression = _bundlespeccompressions[compression]
- version = _bundlespeccgversions[version]
+ if not externalnames:
+ compression = _bundlespeccompressions[compression]
+ version = _bundlespeccgversions[version]
return compression, version
def readbundle(ui, fh, fname, vfs=None):