changeset 20247:a259f7b488ab

rebase: improve error message for empty --rev set Before, it just said 'nothing to rebase' in this case. Now, it aborts mentioning the reason: 'empty "rev" revision set'. Specifying revisions that cannot be rebased is a 'soft' error, but specifying an empty set deserves an abort that explains exactly what the problem is.
author Mads Kiilerich <madski@unity3d.com>
date Sat, 16 Nov 2013 15:46:29 -0500
parents e4dc4c89b03a
children 3bff26f67169
files hgext/rebase.py tests/test-rebase-parameters.t
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sun Nov 17 18:21:58 2013 -0500
+++ b/hgext/rebase.py	Sat Nov 16 15:46:29 2013 -0500
@@ -221,6 +221,9 @@
 
             if revf:
                 rebaseset = scmutil.revrange(repo, revf)
+                if not rebaseset:
+                    raise util.Abort(_('empty "rev" revision set - '
+                                       'nothing to rebase'))
             elif srcf:
                 src = scmutil.revrange(repo, [srcf])
                 rebaseset = repo.revs('(%ld)::', src)
--- a/tests/test-rebase-parameters.t	Sun Nov 17 18:21:58 2013 -0500
+++ b/tests/test-rebase-parameters.t	Sat Nov 16 15:46:29 2013 -0500
@@ -79,6 +79,10 @@
   abort: cannot specify both a revision and a base
   [255]
 
+  $ hg rebase --rev '1 & !1'
+  abort: empty "rev" revision set - nothing to rebase
+  [255]
+
   $ hg rebase
   nothing to rebase
   [1]