util: don't complain about '..' in path components not working on Windows stable
authorMatt Mackall <mpm@selenic.com>
Mon, 24 Oct 2011 16:57:14 -0500
branchstable
changeset 15358 a347b3614bae
parent 15357 8ec1a2cfd2c0
child 15359 a5a8adf95e51
util: don't complain about '..' in path components not working on Windows
mercurial/util.py
--- 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