# HG changeset patch # User Durham Goode # Date 1453239830 28800 # Node ID 645e78845383591af0efc437c195fabee234f2a3 # Parent d2c5ad3deccb5a504e2553652b66a4110db68afb bundle: exit early when there are no commits to bundle Previously, if you passed a revset that resolved to no nodes, it would get interpreted by the changegroup discovery logic as 'bundle all my heads', which is not what the user asked. Let's exit early when we notice this case. It could be argued that the changeset discovery logic should be smarter and only assume 'all heads' if the incoming heads parameter is None, but that's a much riskier change. diff -r d2c5ad3deccb -r 645e78845383 mercurial/commands.py --- a/mercurial/commands.py Sun Jan 17 20:37:29 2016 -0800 +++ b/mercurial/commands.py Tue Jan 19 13:43:50 2016 -0800 @@ -1328,7 +1328,10 @@ """ 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 -r d2c5ad3deccb -r 645e78845383 tests/test-bundle.t --- a/tests/test-bundle.t Sun Jan 17 20:37:29 2016 -0800 +++ b/tests/test-bundle.t Tue Jan 19 13:43:50 2016 -0800 @@ -728,4 +728,8 @@ 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]