diff mercurial/dirstate.py @ 16323:0789d1bbf6c1 stable

dirstate: fix some problems for recursive case normalization (issue3342) file in nested directory causes unexpected abort. problems below should be fixed for recursive normalization route in dirstate._normalize(): 1. rsplit() may cause unpacking into more than 2 elements. it should be called with 'maxsplit' argument to unpack into 'd, f' 2. 'd' is replaced by normalized value prefixed with 'self._root', but this makes 'folded' as absolute path, and it is unexpected one for caller of recursive normalization
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 31 Mar 2012 15:55:03 +0900
parents e785456f9631
children 14a4e17f0817
line wrap: on
line diff
--- a/mercurial/dirstate.py	Sat Mar 31 10:44:31 2012 -0500
+++ b/mercurial/dirstate.py	Sat Mar 31 15:55:03 2012 +0900
@@ -406,9 +406,10 @@
                 # recursively normalize leading directory components
                 # against dirstate
                 if '/' in normed:
-                    d, f = normed.rsplit('/')
-                    d = self._root + "/" + self._normalize(d, isknown)
-                    folded = d + "/" + util.fspath(f, d)
+                    d, f = normed.rsplit('/', 1)
+                    d = self._normalize(d, isknown)
+                    r = self._root + "/" + d
+                    folded = d + "/" + util.fspath(f, r)
                 else:
                     folded = util.fspath(normed, self._root)
                 self._foldmap[normed] = folded