Patchwork D11496: errors: use InputError for some invalid revsets and such

login
register
mail settings
Submitter phabricator
Date Sept. 23, 2021, 6:26 p.m.
Message ID <differential-rev-PHID-DREV-vloadopil7plhjg3mdsn-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49816/
State Superseded
Headers show

Comments

phabricator - Sept. 23, 2021, 6:26 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11496

AFFECTED FILES
  mercurial/commands.py
  mercurial/scmutil.py
  tests/test-diff-change.t
  tests/test-extdiff.t
  tests/test-rebase-parameters.t
  tests/test-revset2.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-revset2.t b/tests/test-revset2.t
--- a/tests/test-revset2.t
+++ b/tests/test-revset2.t
@@ -840,7 +840,7 @@ 
 
   $ hg diff -r 'author("babar") or author("celeste")'
   abort: empty revision range
-  [255]
+  [10]
 
 aliases:
 
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
@@ -132,7 +132,7 @@ 
 
   $ hg rebase --dest '1 & !1'
   abort: empty revision set
-  [255]
+  [10]
 
 These work:
 
diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -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:
 
diff --git a/tests/test-diff-change.t b/tests/test-diff-change.t
--- a/tests/test-diff-change.t
+++ b/tests/test-diff-change.t
@@ -119,7 +119,7 @@ 
   +wdir
   $ hg diff -r "2 and 1"
   abort: empty revision range
-  [255]
+  [10]
 
   $ cd ..
 
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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]):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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: