errors: use InputError for bad --similarity value
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 23 Sep 2021 09:40:01 -0700
changeset 48031 5b89626c11e9
parent 48030 7d908ee19b5b
child 48032 12966768595a
errors: use InputError for bad --similarity value Differential Revision: https://phab.mercurial-scm.org/D11497
mercurial/scmutil.py
tests/test-addremove-similar.t
--- 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 ..