[PATCH] issue 1286

Petr Kodl petrkodl at gmail.com
Thu Sep 4 13:06:59 CDT 2008


# HG changeset patch
# User Petr Kodl <petrkodl at gmail.com>
# Date 1220551484 14400
# Node ID 0a891c8181c57954a83751022cbab830a65beab0
# Parent  6c4a08270222569ba906f4f1c7860783eec19225
issue 1286

diff -r 6c4a08270222 -r 0a891c8181c5 mercurial/dirstate.py
--- a/mercurial/dirstate.py	Wed Sep 03 19:03:57 2008 +0200
+++ b/mercurial/dirstate.py	Thu Sep 04 14:04:44 2008 -0400
@@ -42,10 +42,11 @@
             return self._copymap
         elif name == '_foldmap':
             _foldmap = {}
-            for name in self._map:
-                norm = os.path.normcase(os.path.normpath(name))
-                _foldmap[norm] = name
-            self._foldmap = _foldmap
+            if self._checkcase:
+                for name in self._map:
+                    norm = os.path.normcase(os.path.normpath(name))
+                    _foldmap[norm] = name
+                self._foldmap = _foldmap
             return self._foldmap
         elif name == '_branch':
             try:
@@ -518,7 +519,11 @@
                         and entries[hg][1] == dirkind:
                         continue
             for f, kind, st in entries:
-                nf = normalize(nd and (nd + "/" + f) or f)
+                nf = nd and (nd + "/" + f) or f
+                # and look for the original unfolded name
+                # calling normalize is expensive here and causes pathological slowdown 
+                # on fresh files 
+                nf = self._foldmap.get(os.normcase(nf),nf)
                 if nf not in results:
                     if kind == dirkind:
                         if not ignore(nf):


More information about the Mercurial-devel mailing list