changeset 21210:799c494189a9 stable

rebase: empty revset should be a gentle no-op with exit code 1, not an error
author Mads Kiilerich <madski@unity3d.com>
date Thu, 01 May 2014 16:47:50 +0200
parents c5d35995d192
children 004267ce0338
files hgext/rebase.py tests/test-rebase-parameters.t
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Thu May 01 15:12:49 2014 +0200
+++ b/hgext/rebase.py	Thu May 01 16:47:50 2014 +0200
@@ -228,15 +228,17 @@
             elif srcf:
                 src = scmutil.revrange(repo, [srcf])
                 if not src:
-                    raise util.Abort(_('empty "source" revision set - '
-                                       'nothing to rebase'))
+                    ui.status(_('empty "source" revision set - '
+                                'nothing to rebase\n'))
+                    return 1
                 rebaseset = repo.revs('(%ld)::', src)
                 assert rebaseset
             else:
                 base = scmutil.revrange(repo, [basef or '.'])
                 if not base:
-                    raise util.Abort(_('empty "base" revision set - '
-                                       "can't compute rebase set"))
+                    ui.status(_('empty "base" revision set - '
+                                "can't compute rebase set\n"))
+                    return 1
                 rebaseset = repo.revs(
                     '(children(ancestor(%ld, %d)) and ::(%ld))::',
                     base, dest, base)
--- a/tests/test-rebase-parameters.t	Thu May 01 15:12:49 2014 +0200
+++ b/tests/test-rebase-parameters.t	Thu May 01 16:47:50 2014 +0200
@@ -84,12 +84,12 @@
   [1]
 
   $ hg rebase --source '1 & !1'
-  abort: empty "source" revision set - nothing to rebase
-  [255]
+  empty "source" revision set - nothing to rebase
+  [1]
 
   $ hg rebase --base '1 & !1'
-  abort: empty "base" revision set - can't compute rebase set
-  [255]
+  empty "base" revision set - can't compute rebase set
+  [1]
 
   $ hg rebase
   nothing to rebase - working directory parent is also destination