comparison mercurial/commands.py @ 51554:cc44b3df9bb4

bundle: do no check the changegroup version if no changegroup is included We don't need to check the compatibility of something we will not use. In practice this was getting in the was of `streamv2` bundles on a narrow repository as the 'cg.version=02' value was rejected by this checks.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 02 Apr 2024 17:02:39 +0200
parents 15e680a44502
children 45ba8416afc4
comparison
equal deleted inserted replaced
51553:f1512dbfee9f 51554:cc44b3df9bb4
1624 except error.UnsupportedBundleSpecification as e: 1624 except error.UnsupportedBundleSpecification as e:
1625 raise error.InputError( 1625 raise error.InputError(
1626 pycompat.bytestr(e), 1626 pycompat.bytestr(e),
1627 hint=_(b"see 'hg help bundlespec' for supported values for --type"), 1627 hint=_(b"see 'hg help bundlespec' for supported values for --type"),
1628 ) 1628 )
1629
1630 has_changegroup = bundlespec.params.get(b"changegroup", False)
1629 cgversion = bundlespec.params[b"cg.version"] 1631 cgversion = bundlespec.params[b"cg.version"]
1630 1632
1631 # Packed bundles are a pseudo bundle format for now. 1633 # Packed bundles are a pseudo bundle format for now.
1632 if cgversion == b's1': 1634 if cgversion == b's1':
1633 raise error.InputError( 1635 raise error.InputError(
1660 if not base: 1662 if not base:
1661 # base specified, but nothing was selected 1663 # base specified, but nothing was selected
1662 base = [nullrev] 1664 base = [nullrev]
1663 else: 1665 else:
1664 base = None 1666 base = None
1665 if cgversion not in changegroup.supportedoutgoingversions(repo): 1667 supported_cg_versions = changegroup.supportedoutgoingversions(repo)
1668 if has_changegroup and cgversion not in supported_cg_versions:
1666 raise error.Abort( 1669 raise error.Abort(
1667 _(b"repository does not support bundle version %s") % cgversion 1670 _(b"repository does not support bundle version %s") % cgversion
1668 ) 1671 )
1669 1672
1670 if base is not None: 1673 if base is not None: