diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1399,6 +1399,10 @@ def bundle(ui, repo, fname, dest=None, * base = scmutil.revrange(repo, opts.get('base')) # TODO: get desired bundlecaps from command line. bundlecaps = None + if cgversion not in changegroup.supportedoutgoingversions(repo): + raise error.Abort(_("repository does not support bundle version %s") % + cgversion) + if base: if dest: raise error.Abort(_("--base is incompatible with specifying " diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -736,3 +736,9 @@ Packed bundle bundle requirements: generaldelta, revlogv1, treemanifest $ hg debugbundle --spec repo-packed.hg none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Ctreemanifest + +Bundle with changegroup2 is not supported + + $ hg -R deeprepo bundle --all -t v2 deeprepo.bundle + abort: repository does not support bundle version 02 + [255]