D9326: errors: use InputError for errors about bad paths
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Nov 17 00:28:55 UTC 2020
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/D9326
AFFECTED FILES
mercurial/scmutil.py
tests/test-add.t
tests/test-copy.t
tests/test-eolfilename.t
tests/test-rename.t
CHANGE DETAILS
diff --git a/tests/test-rename.t b/tests/test-rename.t
--- a/tests/test-rename.t
+++ b/tests/test-rename.t
@@ -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
diff --git a/tests/test-eolfilename.t b/tests/test-eolfilename.t
--- a/tests/test-eolfilename.t
+++ b/tests/test-eolfilename.t
@@ -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
diff --git a/tests/test-copy.t b/tests/test-copy.t
--- a/tests/test-copy.t
+++ b/tests/test-copy.t
@@ -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
diff --git a/tests/test-add.t b/tests/test-add.t
--- a/tests/test-add.t
+++ b/tests/test-add.t
@@ -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
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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)
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list