D11496: errors: use InputError for some invalid revsets and such
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Sep 23 18:26:26 UTC 2021
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
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:
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list