[PATCH 1 of 5] checkwinfilename: use %r in format string
Adrian Buehlmann
adrian at cadifra.com
Sat Apr 16 07:35:16 CDT 2011
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1302876923 -7200
# Node ID fb38be10ed99f8499b7fff0c1cbb5f5a505deedf
# Parent 924f40b977ee72ef7a3c1dce38b6aaa8c24198cd
checkwinfilename: use %r in format string
and adding doctests for \n and \r
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -511,8 +511,12 @@
"filename contains 'AUX', which is reserved on Windows"
>>> checkwinfilename("foo/bar/bla:.txt")
"filename contains ':', which is reserved on Windows"
- >>> checkwinfilename("foo/bar/b\07la.txt")
- "filename contains '\\x07', which is invalid on Windows"
+ >>> checkwinfilename("foo/bar/jj\\07jj.txt")
+ "filename contains '\\\\x07', which is invalid on Windows"
+ >>> checkwinfilename("foo/bar/jj\\njj.txt")
+ "filename contains '\\\\n', which is invalid on Windows"
+ >>> checkwinfilename("foo/bar/jj\\rjj.txt")
+ "filename contains '\\\\r', which is invalid on Windows"
>>> checkwinfilename("foo/bar/bla ")
"filename ends with ' ', which is not allowed on Windows"
'''
@@ -524,7 +528,7 @@
return _("filename contains '%s', which is reserved "
"on Windows") % c
if ord(c) <= 31:
- return _("filename contains '%s', which is invalid "
+ return _("filename contains %r, which is invalid "
"on Windows") % c
base = n.split('.')[0]
if base and base.lower() in _windows_reserved_filenames:
More information about the Mercurial-devel
mailing list