diff --git a/mercurial/commands.py b/mercurial/commands.py index 44d1959acb3b580687723a67fdfc96ab273e040c_bWVyY3VyaWFsL2NvbW1hbmRzLnB5..5527aa808dea5bc7b53d6f1f3afd450af6bbaf10_bWVyY3VyaWFsL2NvbW1hbmRzLnB5 100644 --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1245,5 +1245,4 @@ scmutil.nochangesfound(ui, repo, not base and outgoing.excluded) return 1 - bcompression = bundlespec.compression if cgversion == '01': #bundle1 @@ -1249,7 +1248,5 @@ 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' @@ -1253,6 +1250,7 @@ bcompression = None elif cgversion in ('02', '03'): bversion = 'HG20' + bcompression = bundlespec.wirecompression else: raise error.ProgrammingError( 'bundle: unexpected changegroup version %s' % cgversion) diff --git a/mercurial/exchange.py b/mercurial/exchange.py index 44d1959acb3b580687723a67fdfc96ab273e040c_bWVyY3VyaWFsL2V4Y2hhbmdlLnB5..5527aa808dea5bc7b53d6f1f3afd450af6bbaf10_bWVyY3VyaWFsL2V4Y2hhbmdlLnB5 100644 --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -86,4 +86,5 @@ @attr.s class bundlespec(object): compression = attr.ib() + wirecompression = attr.ib() version = attr.ib() @@ -89,4 +90,5 @@ version = attr.ib() + wireversion = attr.ib() params = attr.ib() contentopts = attr.ib() @@ -90,7 +92,7 @@ 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,8 +214,7 @@ 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] @@ -222,5 +220,6 @@ - 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,7 +2266,7 @@ 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 @@ -2272,7 +2270,8 @@ 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