changeset 26646:77769354d4ad

exchange: support preserving external names when parsing bundle specs This will be needed to make client-side preferences work easier.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 13 Oct 2015 12:29:50 -0700
parents 2faa7671a4b3
children 62b0fa0d8787
files mercurial/exchange.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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):