changeset 48031:5b89626c11e9

errors: use InputError for bad --similarity value Differential Revision: https://phab.mercurial-scm.org/D11497
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 23 Sep 2021 09:40:01 -0700
parents 7d908ee19b5b
children 12966768595a
files mercurial/scmutil.py tests/test-addremove-similar.t
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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 ..