# HG changeset patch # User Martin von Zweigbergk # Date 2021-09-23 16:40:01 # Node ID 5b89626c11e9687169ca4407efe3de3b19b59e47 # Parent 7d908ee19b5b2f78d5a1987c1e5fd976a101d397 errors: use InputError for bad --similarity value Differential Revision: https://phab.mercurial-scm.org/D11497 diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1211,9 +1211,9 @@ def addremove(repo, matcher, prefix, uip 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 diff --git a/tests/test-addremove-similar.t b/tests/test-addremove-similar.t --- a/tests/test-addremove-similar.t +++ b/tests/test-addremove-similar.t @@ -131,13 +131,13 @@ should all fail $ 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 ..