changeset 20248:3bff26f67169

rebase: improve error message for empty --source set Before, it just said 'nothing to rebase' in this case. Now, it aborts mentioning the reason: 'empty "source" 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 Sun, 17 Nov 2013 18:21:58 -0500
parents a259f7b488ab
children dc5157841361
files hgext/rebase.py tests/test-rebase-parameters.t
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sat Nov 16 15:46:29 2013 -0500
+++ b/hgext/rebase.py	Sun Nov 17 18:21:58 2013 -0500
@@ -226,7 +226,11 @@
                                        'nothing to rebase'))
             elif srcf:
                 src = scmutil.revrange(repo, [srcf])
+                if not src:
+                    raise util.Abort(_('empty "source" revision set - '
+                                       'nothing to rebase'))
                 rebaseset = repo.revs('(%ld)::', src)
+                assert rebaseset
             else:
                 base = scmutil.revrange(repo, [basef or '.'])
                 rebaseset = repo.revs(
--- a/tests/test-rebase-parameters.t	Sat Nov 16 15:46:29 2013 -0500
+++ b/tests/test-rebase-parameters.t	Sun Nov 17 18:21:58 2013 -0500
@@ -83,6 +83,10 @@
   abort: empty "rev" revision set - nothing to rebase
   [255]
 
+  $ hg rebase --source '1 & !1'
+  abort: empty "source" revision set - nothing to rebase
+  [255]
+
   $ hg rebase
   nothing to rebase
   [1]