diff mercurial/scmutil.py @ 15674:7b7f03502b5a

merge with stable
author Matt Mackall <mpm@selenic.com>
date Fri, 16 Dec 2011 19:05:59 -0600
parents 18f1bb70462e 37a6e9765015
children 5b384b7f48d5
line wrap: on
line diff
--- a/mercurial/scmutil.py	Thu Dec 15 16:50:21 2011 -0600
+++ b/mercurial/scmutil.py	Fri Dec 16 19:05:59 2011 -0600
@@ -76,18 +76,22 @@
         self.auditeddir = set()
         self.root = root
         self.callback = callback
+        if os.path.lexists(root) and not util.checkcase(root):
+            self.normcase = util.normcase
+        else:
+            self.normcase = lambda x: x
 
     def __call__(self, path):
         '''Check the relative path.
         path may contain a pattern (e.g. foodir/**.txt)'''
 
-        if path in self.audited:
+        normpath = self.normcase(path)
+        if normpath in self.audited:
             return
         # AIX ignores "/" at end of path, others raise EISDIR.
         if util.endswithsep(path):
             raise util.Abort(_("path ends in directory separator: %s") % path)
-        normpath = os.path.normcase(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 +105,16 @@
                     raise util.Abort(_("path '%s' 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,10 +134,11 @@
                     if not self.callback or not self.callback(curpath):
                         raise util.Abort(_("path '%s' is inside nested repo %r") %
                                          (path, prefix))
-            prefixes.append(prefix)
+            prefixes.append(normprefix)
             parts.pop()
+            normparts.pop()
 
-        self.audited.add(path)
+        self.audited.add(normpath)
         # only add prefixes to the cache after checking everything: we don't
         # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
         self.auditeddir.update(prefixes)