diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1328,7 +1328,10 @@ def bundle(ui, repo, fname, dest=None, * """ revs = None if 'rev' in opts: - revs = scmutil.revrange(repo, opts['rev']) + revstrings = opts['rev'] + revs = scmutil.revrange(repo, revstrings) + if revstrings and not revs: + raise error.Abort(_('no commits to bundle')) bundletype = opts.get('type', 'bzip2').lower() try: diff --git a/tests/test-bundle.t b/tests/test-bundle.t --- a/tests/test-bundle.t +++ b/tests/test-bundle.t @@ -728,4 +728,8 @@ bundle single branch checking files 4 files, 3 changesets, 5 total revisions - $ cd .. +== Test bundling no commits + + $ hg bundle -r 'public()' no-output.hg + abort: no commits to bundle + [255]