changeset 45844:3175b0e0058b

errors: use InputError for errors about bad paths Differential Revision: https://phab.mercurial-scm.org/D9326
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 12 Nov 2020 09:53:14 -0800
parents c7abdbc8fd47
children f96fa4de5055
files mercurial/scmutil.py tests/test-add.t tests/test-copy.t tests/test-eolfilename.t tests/test-rename.t
diffstat 5 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Tue Nov 10 09:14:01 2020 -0800
+++ b/mercurial/scmutil.py	Thu Nov 12 09:53:14 2020 -0800
@@ -311,7 +311,7 @@
 def checkfilename(f):
     '''Check that the filename f is an acceptable filename for a tracked file'''
     if b'\r' in f or b'\n' in f:
-        raise error.Abort(
+        raise error.InputError(
             _(b"'\\n' and '\\r' disallowed in filenames: %r")
             % pycompat.bytestr(f)
         )
@@ -326,7 +326,7 @@
         if msg:
             msg = b"%s: %s" % (msg, procutil.shellquote(f))
             if abort:
-                raise error.Abort(msg)
+                raise error.InputError(msg)
             ui.warn(_(b"warning: %s\n") % msg)
 
 
--- a/tests/test-add.t	Tue Nov 10 09:14:01 2020 -0800
+++ b/tests/test-add.t	Thu Nov 12 09:53:14 2020 -0800
@@ -48,7 +48,7 @@
   [30]
   $ hg --config ui.portablefilenames=abort add con.xml
   abort: filename contains 'con', which is reserved on Windows: con.xml
-  [255]
+  [10]
   $ hg st
   A a
   A b
@@ -68,7 +68,7 @@
   $ hg --config ui.portablefilenames=abort add
   adding hello:world
   abort: filename contains ':', which is reserved on Windows: 'hello:world'
-  [255]
+  [10]
   $ hg st
   A a
   A b
--- a/tests/test-copy.t	Tue Nov 10 09:14:01 2020 -0800
+++ b/tests/test-copy.t	Thu Nov 12 09:53:14 2020 -0800
@@ -9,7 +9,7 @@
   $ hg copy a b
   $ hg --config ui.portablefilenames=abort copy a con.xml
   abort: filename contains 'con', which is reserved on Windows: con.xml
-  [255]
+  [10]
   $ hg status
   A b
   $ hg sum
--- a/tests/test-eolfilename.t	Tue Nov 10 09:14:01 2020 -0800
+++ b/tests/test-eolfilename.t	Thu Nov 12 09:53:14 2020 -0800
@@ -12,12 +12,12 @@
   adding he\r (no-eol) (esc)
   llo
   abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
-  [255]
+  [10]
   $ hg ci -A -m m
   adding he\r (no-eol) (esc)
   llo
   abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
-  [255]
+  [10]
   $ rm "$A"
   $ echo foo > "hell
   > o"
@@ -25,12 +25,12 @@
   adding hell
   o
   abort: '\n' and '\r' disallowed in filenames: 'hell\no'
-  [255]
+  [10]
   $ hg ci -A -m m
   adding hell
   o
   abort: '\n' and '\r' disallowed in filenames: 'hell\no'
-  [255]
+  [10]
   $ echo foo > "$A"
   $ hg debugwalk -v
   * matcher:
@@ -48,10 +48,10 @@
   $ A=`printf 'quick\rfox'`
   $ hg cp quickfox "$A"
   abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
-  [255]
+  [10]
   $ hg mv quickfox "$A"
   abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
-  [255]
+  [10]
 
 https://bz.mercurial-scm.org/2036
 
--- a/tests/test-rename.t	Tue Nov 10 09:14:01 2020 -0800
+++ b/tests/test-rename.t	Thu Nov 12 09:53:14 2020 -0800
@@ -13,7 +13,7 @@
   $ hg rename d1/d11/a1 d2/c
   $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml
   abort: filename contains 'con', which is reserved on Windows: d1/con.xml
-  [255]
+  [10]
   $ hg sum
   parent: 0:9b4b6e7b2c26 tip
    1