[PATCH 01 of 13 STABLE V4] pathauditor: use normcase()-ed path for audit result cache

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Dec 16 06:27:09 CST 2011


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1324037380 -32400
# Branch stable
# Node ID 4dcc070600bf74cc6c098e0a6206e78682a7266d
# Parent  971c55ce03b81cc71ea33342bc432cc359e79e2a
pathauditor: use normcase()-ed path for audit result cache

in current pathauditor implementation, un-normcase()-ed path is
stored into and compared with audit result cache.

this is not efficiency on case insensitive filesystem.

diff -r 971c55ce03b8 -r 4dcc070600bf mercurial/scmutil.py
--- a/mercurial/scmutil.py	Thu Dec 15 13:19:43 2011 -0500
+++ b/mercurial/scmutil.py	Fri Dec 16 21:09:40 2011 +0900
@@ -81,12 +81,12 @@
         '''Check the relative path.
         path may contain a pattern (e.g. foodir/**.txt)'''
 
-        if path in self.audited:
+        normpath = os.path.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)
         if (os.path.splitdrive(path)[0]
             or parts[0].lower() in ('.hg', '.hg.', '')
@@ -128,7 +128,7 @@
             prefixes.append(prefix)
             parts.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)


More information about the Mercurial-devel mailing list