Patchwork D11826: errors: use detailed exit code for non-integer number of diff context lines

login
register
mail settings
Submitter phabricator
Date Nov. 29, 2021, 9:58 p.m.
Message ID <differential-rev-PHID-DREV-qfqglnixz7tf5x4i5uhd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50150/
State Superseded
Headers show

Comments

phabricator - Nov. 29, 2021, 9:58 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/mdiff.py
  tests/test-diff-unified.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-diff-unified.t b/tests/test-diff-unified.t
--- a/tests/test-diff-unified.t
+++ b/tests/test-diff-unified.t
@@ -46,7 +46,7 @@ 
 
   $ hg diff --nodates -U foo
   abort: diff context lines count must be an integer, not 'foo'
-  [255]
+  [10]
 
 
   $ hg diff --nodates -U 2
@@ -87,7 +87,7 @@ 
 
   $ hg --config diff.unified=foo diff --nodates
   abort: diff context lines count must be an integer, not 'foo'
-  [255]
+  [10]
 
 noprefix config and option
 
diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -84,7 +84,7 @@ 
         try:
             self.context = int(self.context)
         except ValueError:
-            raise error.Abort(
+            raise error.InputError(
                 _(b'diff context lines count must be an integer, not %r')
                 % pycompat.bytestr(self.context)
             )