Patchwork [02,of,10] rebase: improve error message for empty --rev set

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 12, 2014, 4:08 p.m.
Message ID <d4c3a8ae89b0e2bf1e8a.1389542880@localhost.localdomain>
Download mbox | patch
Permalink /patch/3296/
State Superseded
Headers show

Comments

Mads Kiilerich - Jan. 12, 2014, 4:08 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1384634789 18000
#      Sat Nov 16 15:46:29 2013 -0500
# Node ID d4c3a8ae89b0e2bf1e8a0bebb3fd6ba49ad1ac62
# Parent  e3be09b53038b39614eff4e57b47896cca103a31
rebase: improve error message for empty --rev set

Before it just said 'nothing to rebase', now it also hints to the reason:
'rev revset is empty'.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -221,6 +221,9 @@  def rebase(ui, repo, **opts):
 
             if revf:
                 rebaseset = scmutil.revrange(repo, revf)
+                if not rebaseset:
+                    ui.status(_('nothing to rebase - rev revset is empty\n'))
+                    return 1
             elif srcf:
                 src = scmutil.revrange(repo, [srcf])
                 rebaseset = repo.revs('(%ld)::', src)
diff --git a/tests/test-rebase-parameters.t b/tests/test-rebase-parameters.t
--- a/tests/test-rebase-parameters.t
+++ b/tests/test-rebase-parameters.t
@@ -89,6 +89,10 @@  These fail:
   nothing to rebase
   [1]
 
+  $ hg rebase -r '1 & !1'
+  nothing to rebase - rev revset is empty
+  [1]
+
 
 These work: