Patchwork D3392: bundlespec: drop externalnames flag

login
register
mail settings
Submitter phabricator
Date April 17, 2018, 8:45 p.m.
Message ID <8d4bbb9361c4b726b46407d603628ab0@localhost.localdomain>
Download mbox | patch
Permalink /patch/31170/
State Not Applicable
Headers show

Comments

phabricator - April 17, 2018, 8:45 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5527aa808dea: bundlespec: drop externalnames flag (authored by joerg.sonnenberger, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3392?vs=8359&id=8376

REVISION DETAIL
  https://phab.mercurial-scm.org/D3392

AFFECTED FILES
  mercurial/commands.py
  mercurial/exchange.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers, lothiraldan, indygreg
Cc: lothiraldan, mercurial-devel

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -86,11 +86,13 @@ 
 @attr.s
 class bundlespec(object):
     compression = attr.ib()
+    wirecompression = attr.ib()
     version = attr.ib()
+    wireversion = attr.ib()
     params = attr.ib()
     contentopts = attr.ib()
 
-def parsebundlespec(repo, spec, strict=True, externalnames=False):
+def parsebundlespec(repo, spec, strict=True):
     """Parse a bundle string specification into parts.
 
     Bundle specifications denote a well-defined bundle/exchange format.
@@ -110,9 +112,6 @@ 
     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 bundlespec object of (compression, version, parameters).
     Compression will be ``None`` if not in strict mode and a compression isn't
     defined.
@@ -215,12 +214,12 @@ 
         variant = _bundlespecvariants["streamv2"]
         contentopts.update(variant)
 
-    if not externalnames:
-        engine = util.compengines.forbundlename(compression)
-        compression = engine.bundletype()[1]
-        version = _bundlespeccgversions[version]
+    engine = util.compengines.forbundlename(compression)
+    compression, wirecompression = engine.bundletype()
+    wireversion = _bundlespeccgversions[version]
 
-    return bundlespec(compression, version, params, contentopts)
+    return bundlespec(compression, wirecompression, version, wireversion,
+                      params, contentopts)
 
 def readbundle(ui, fh, fname, vfs=None):
     header = changegroup.readexactly(fh, 4)
@@ -2253,8 +2252,7 @@ 
             # component of the BUNDLESPEC.
             if key == 'BUNDLESPEC':
                 try:
-                    bundlespec = parsebundlespec(repo, value,
-                                                 externalnames=True)
+                    bundlespec = parsebundlespec(repo, value)
                     attrs['COMPRESSION'] = bundlespec.compression
                     attrs['VERSION'] = bundlespec.version
                 except error.InvalidBundleSpecification:
@@ -2268,11 +2266,12 @@ 
 
 def isstreamclonespec(bundlespec):
     # Stream clone v1
-    if (bundlespec.compression == 'UN' and bundlespec.version == 's1'):
+    if (bundlespec.wirecompression == 'UN' and bundlespec.wireversion == 's1'):
         return True
 
     # Stream clone v2
-    if (bundlespec.compression == 'UN' and bundlespec.version == '02' and \
+    if (bundlespec.wirecompression == 'UN' and \
+        bundlespec.wireversion == '02' and \
         bundlespec.contentopts.get('streamv2')):
         return True
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1245,14 +1245,12 @@ 
         scmutil.nochangesfound(ui, repo, not base and outgoing.excluded)
         return 1
 
-    bcompression = bundlespec.compression
     if cgversion == '01': #bundle1
-        if bcompression is None:
-            bcompression = 'UN'
-        bversion = 'HG10' + bcompression
+        bversion = 'HG10' + bundlespec.wirecompression
         bcompression = None
     elif cgversion in ('02', '03'):
         bversion = 'HG20'
+        bcompression = bundlespec.wirecompression
     else:
         raise error.ProgrammingError(
             'bundle: unexpected changegroup version %s' % cgversion)