Mercurial > public > mercurial-scm > hg
diff mercurial/util.py @ 20012:a1d88278beff
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 16 Nov 2013 12:44:28 -0500 |
parents | c38c3fdc8b93 0849d280663e |
children | 1e5b38a919dd |
line wrap: on
line diff
--- a/mercurial/util.py Fri Nov 15 13:20:49 2013 -0800 +++ b/mercurial/util.py Sat Nov 16 12:44:28 2013 -0500 @@ -563,7 +563,7 @@ lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9'''.split() _winreservedchars = ':*?"<>|' def checkwinfilename(path): - '''Check that the base-relative path is a valid filename on Windows. + r'''Check that the base-relative path is a valid filename on Windows. Returns None if the path is ok, or a UI string describing the problem. >>> checkwinfilename("just/a/normal/path") @@ -577,11 +577,19 @@ >>> 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" + "filename contains '\\x07', which is invalid on Windows" >>> checkwinfilename("foo/bar/bla ") "filename ends with ' ', which is not allowed on Windows" >>> checkwinfilename("../bar") + >>> checkwinfilename("foo\\") + "filename ends with '\\', which is invalid on Windows" + >>> checkwinfilename("foo\\/bar") + "directory name ends with '\\', which is invalid on Windows" ''' + if path.endswith('\\'): + return _("filename ends with '\\', which is invalid on Windows") + if '\\/' in path: + return _("directory name ends with '\\', which is invalid on Windows") for n in path.replace('\\', '/').split('/'): if not n: continue