errors: use InputError for bad --similarity value
Differential Revision: https://phab.mercurial-scm.org/D11497
--- a/mercurial/scmutil.py Thu Sep 23 09:38:45 2021 -0700
+++ b/mercurial/scmutil.py Thu Sep 23 09:40:01 2021 -0700
@@ -1211,9 +1211,9 @@
try:
similarity = float(opts.get(b'similarity') or 0)
except ValueError:
- raise error.Abort(_(b'similarity must be a number'))
+ raise error.InputError(_(b'similarity must be a number'))
if similarity < 0 or similarity > 100:
- raise error.Abort(_(b'similarity must be between 0 and 100'))
+ raise error.InputError(_(b'similarity must be between 0 and 100'))
similarity /= 100.0
ret = 0
--- a/tests/test-addremove-similar.t Thu Sep 23 09:38:45 2021 -0700
+++ b/tests/test-addremove-similar.t Thu Sep 23 09:40:01 2021 -0700
@@ -131,13 +131,13 @@
$ hg addremove -s foo
abort: similarity must be a number
- [255]
+ [10]
$ hg addremove -s -1
abort: similarity must be between 0 and 100
- [255]
+ [10]
$ hg addremove -s 1e6
abort: similarity must be between 0 and 100
- [255]
+ [10]
$ cd ..