pathauditor: preserve case in abort messages stable
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Fri, 16 Dec 2011 21:09:40 +0900
branchstable
changeset 15665 081e795c60e0
parent 15664 ec8730886f36
child 15666 37a6e9765015
pathauditor: preserve case in abort messages this patch uses both plain and normcase()-ed pathes to preserve letter case of path in abort messages.
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Fri Dec 16 21:09:40 2011 +0900
+++ b/mercurial/scmutil.py	Fri Dec 16 21:09:40 2011 +0900
@@ -87,7 +87,7 @@
         # AIX ignores "/" at end of path, others raise EISDIR.
         if util.endswithsep(path):
             raise util.Abort(_("path ends in directory separator: %s") % path)
-        parts = util.splitpath(normpath)
+        parts = util.splitpath(path)
         if (os.path.splitdrive(path)[0]
             or parts[0].lower() in ('.hg', '.hg.', '')
             or os.pardir in parts):
@@ -101,11 +101,16 @@
                     raise util.Abort(_('path %r is inside nested repo %r')
                                      % (path, base))
 
+        normparts = util.splitpath(normpath)
+        assert len(parts) == len(normparts)
+
         parts.pop()
+        normparts.pop()
         prefixes = []
         while parts:
             prefix = os.sep.join(parts)
-            if prefix in self.auditeddir:
+            normprefix = os.sep.join(normparts)
+            if normprefix in self.auditeddir:
                 break
             curpath = os.path.join(self.root, prefix)
             try:
@@ -125,8 +130,9 @@
                     if not self.callback or not self.callback(curpath):
                         raise util.Abort(_('path %r is inside nested repo %r') %
                                          (path, prefix))
-            prefixes.append(prefix)
+            prefixes.append(normprefix)
             parts.pop()
+            normparts.pop()
 
         self.audited.add(normpath)
         # only add prefixes to the cache after checking everything: we don't