changeset 15358:a347b3614bae stable

util: don't complain about '..' in path components not working on Windows
author Matt Mackall <mpm@selenic.com>
date Mon, 24 Oct 2011 16:57:14 -0500
parents 8ec1a2cfd2c0
children a5a8adf95e51
files mercurial/util.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Mon Oct 24 12:09:12 2011 -0500
+++ b/mercurial/util.py	Mon Oct 24 16:57:14 2011 -0500
@@ -514,6 +514,7 @@
     "filename contains '\\\\x07', which is invalid on Windows"
     >>> checkwinfilename("foo/bar/bla ")
     "filename ends with ' ', which is not allowed on Windows"
+    >>> checkwinfilename("../bar")
     '''
     for n in path.replace('\\', '/').split('/'):
         if not n:
@@ -530,7 +531,7 @@
             return _("filename contains '%s', which is reserved "
                      "on Windows") % base
         t = n[-1]
-        if t in '. ':
+        if t in '. ' and n not in '..':
             return _("filename ends with '%s', which is not allowed "
                      "on Windows") % t