# HG changeset patch # User Martin von Zweigbergk # Date 2016-03-26 06:05:32 # Node ID c4b727795d6a5770ec523c1965b464baed81097f # Parent 07f1fbf1f75876e17bcf28757caf8e44a73547cd bundle: avoid crash when no good changegroup version found When using treemanifests, only changegroup3 bundles can be created. However, there is currently no way of requesting a changegroup3 bundle, so we run into an assertion in changegroup.getbundler() when trying to get a changroup2 bundler. Let's avoid the traceback and print a short error message instead. 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]