changeset 24198:3cc630be5f09 stable

dirstate: make sure rootdir ends with directory separator (issue4557) ntpath.join() of Python 2.7.9 does not work as expected if root is a UNC path to top of share. This patch doesn't take care of os.altsep, '/' on Windows, because root should be normalized by realpath().
author Yuya Nishihara <yuya@tcha.org>
date Fri, 06 Mar 2015 00:14:22 +0900
parents 4e01b0332559
children 4ef4e3c3c006 b73a22d1d9bf
files mercurial/dirstate.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Wed Mar 04 17:24:12 2015 +0100
+++ b/mercurial/dirstate.py	Fri Mar 06 00:14:22 2015 +0900
@@ -38,7 +38,12 @@
         self._opener = opener
         self._validate = validate
         self._root = root
-        self._rootdir = os.path.join(root, '')
+        # ntpath.join(root, '') of Python 2.7.9 does not add sep if root is
+        # UNC path pointing to root share (issue4557)
+        if root.endswith(os.sep):
+            self._rootdir = root
+        else:
+            self._rootdir = root + os.sep
         self._dirty = False
         self._dirtypl = False
         self._lastnormaltime = 0