# HG changeset patch # User Gregory Szorc # Date 1444764590 25200 # Node ID 77769354d4adcd9c6db0bb5e4dfb9062d0befe8e # Parent 2faa7671a4b3686a433b1f490e5b37222a99cc0d exchange: support preserving external names when parsing bundle specs This will be needed to make client-side preferences work easier. diff -r 2faa7671a4b3 -r 77769354d4ad mercurial/exchange.py --- 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) 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):