changeset 51595: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 f1512dbfee9f
children c4aab3661f25
files mercurial/commands.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Mar 27 18:51:33 2024 +0000
+++ b/mercurial/commands.py	Tue Apr 02 17:02:39 2024 +0200
@@ -1626,6 +1626,8 @@
             pycompat.bytestr(e),
             hint=_(b"see 'hg help bundlespec' for supported values for --type"),
         )
+
+    has_changegroup = bundlespec.params.get(b"changegroup", False)
     cgversion = bundlespec.params[b"cg.version"]
 
     # Packed bundles are a pseudo bundle format for now.
@@ -1662,7 +1664,8 @@
             base = [nullrev]
     else:
         base = None
-    if cgversion not in changegroup.supportedoutgoingversions(repo):
+    supported_cg_versions = changegroup.supportedoutgoingversions(repo)
+    if has_changegroup and cgversion not in supported_cg_versions:
         raise error.Abort(
             _(b"repository does not support bundle version %s") % cgversion
         )