errors: use InputError for some invalid revsets and such
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 23 Sep 2021 09:38:45 -0700
changeset 48030 7d908ee19b5b
parent 48029 f82c4e8afe5c
child 48031 5b89626c11e9
errors: use InputError for some invalid revsets and such Differential Revision: https://phab.mercurial-scm.org/D11496
mercurial/commands.py
mercurial/scmutil.py
tests/test-diff-change.t
tests/test-extdiff.t
tests/test-rebase-parameters.t
tests/test-revset2.t
--- a/mercurial/commands.py	Thu Sep 23 17:05:37 2021 -0400
+++ b/mercurial/commands.py	Thu Sep 23 09:38:45 2021 -0700
@@ -1081,7 +1081,7 @@
                 raise error.StateError(_(b'current bisect revision is a merge'))
         if rev:
             if not nodes:
-                raise error.Abort(_(b'empty revision set'))
+                raise error.InputError(_(b'empty revision set'))
             node = repo[nodes[-1]].node()
         with hbisect.restore_state(repo, state, node):
             while changesets:
--- a/mercurial/scmutil.py	Thu Sep 23 17:05:37 2021 -0400
+++ b/mercurial/scmutil.py	Thu Sep 23 09:38:45 2021 -0700
@@ -689,7 +689,7 @@
 
     l = revrange(repo, [revspec], localalias=localalias)
     if not l:
-        raise error.Abort(_(b'empty revision set'))
+        raise error.InputError(_(b'empty revision set'))
     return repo[l.last()]
 
 
@@ -710,7 +710,7 @@
     l = revrange(repo, revs)
 
     if not l:
-        raise error.Abort(_(b'empty revision range'))
+        raise error.InputError(_(b'empty revision range'))
 
     first = l.first()
     second = l.last()
@@ -720,7 +720,7 @@
         and len(revs) >= 2
         and not all(revrange(repo, [r]) for r in revs)
     ):
-        raise error.Abort(_(b'empty revision on one side of range'))
+        raise error.InputError(_(b'empty revision on one side of range'))
 
     # if top-level is range expression, the result must always be a pair
     if first == second and len(revs) == 1 and not _pairspec(revs[0]):
--- a/tests/test-diff-change.t	Thu Sep 23 17:05:37 2021 -0400
+++ b/tests/test-diff-change.t	Thu Sep 23 09:38:45 2021 -0700
@@ -119,7 +119,7 @@
   +wdir
   $ hg diff -r "2 and 1"
   abort: empty revision range
-  [255]
+  [10]
 
   $ cd ..
 
--- a/tests/test-extdiff.t	Thu Sep 23 17:05:37 2021 -0400
+++ b/tests/test-extdiff.t	Thu Sep 23 09:38:45 2021 -0700
@@ -87,7 +87,7 @@
 
   $ hg extdiff -p diff --patch --rev 'ancestor()' --rev 1
   abort: empty revision on one side of range
-  [255]
+  [10]
 
 Test diff during merge:
 
--- a/tests/test-rebase-parameters.t	Thu Sep 23 17:05:37 2021 -0400
+++ b/tests/test-rebase-parameters.t	Thu Sep 23 09:38:45 2021 -0700
@@ -132,7 +132,7 @@
 
   $ hg rebase --dest '1 & !1'
   abort: empty revision set
-  [255]
+  [10]
 
 These work:
 
--- a/tests/test-revset2.t	Thu Sep 23 17:05:37 2021 -0400
+++ b/tests/test-revset2.t	Thu Sep 23 09:38:45 2021 -0700
@@ -840,7 +840,7 @@
 
   $ hg diff -r 'author("babar") or author("celeste")'
   abort: empty revision range
-  [255]
+  [10]
 
 aliases: