Patchwork D9308: errors: raise InputError in fancyopts

login
register
mail settings
Submitter phabricator
Date Nov. 12, 2020, 4:39 p.m.
Message ID <differential-rev-PHID-DREV-hanupiad4a6v2sb2h2ro-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47583/
State Superseded
Headers show

Comments

phabricator - Nov. 12, 2020, 4:39 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If a value of wrong type is passed to a command line flag, that's
  cleary an InputError.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9308

AFFECTED FILES
  mercurial/fancyopts.py
  tests/test-import.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-import.t b/tests/test-import.t
--- a/tests/test-import.t
+++ b/tests/test-import.t
@@ -1036,7 +1036,7 @@ 
   adding a
   $ hg import -p foo
   abort: invalid value 'foo' for option -p, expected int
-  [255]
+  [10]
   $ hg import -p0 - << EOF
   > foobar
   > --- a	Sat Apr 12 22:43:58 2008 -0400
diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py
--- a/mercurial/fancyopts.py
+++ b/mercurial/fancyopts.py
@@ -380,7 +380,7 @@ 
         else:
 
             def abort(s):
-                raise error.Abort(
+                raise error.InputError(
                     _(b'invalid value %r for option %s, %s')
                     % (pycompat.maybebytestr(val), opt, s)
                 )