diff mercurial/commands.py @ 27911:645e78845383 stable

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.
author Durham Goode <durham@fb.com>
date Tue, 19 Jan 2016 13:43:50 -0800
parents 78b9fdb844c1
children ae4e6b80f084
line wrap: on
line diff
--- 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: