[PATCH 2 of 6 STABLE V3] icasefs: use util.normcase() instead of str.lower() or os.path.normpath()

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Mon Dec 12 07:25:38 CST 2011


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1323677419 -32400
# Branch stable
# Node ID 7ef5cd9f4a5501388f73efb1f225c52e87acef76
# Parent  3145a0ba21aff7b1d9f9c49fcff8eb286c1c75b6
icasefs: use util.normcase() instead of str.lower() or os.path.normpath()

diff -r 3145a0ba21af -r 7ef5cd9f4a55 mercurial/merge.py
--- a/mercurial/merge.py	Mon Dec 12 17:10:19 2011 +0900
+++ b/mercurial/merge.py	Mon Dec 12 17:10:19 2011 +0900
@@ -7,7 +7,7 @@
 
 from node import nullid, nullrev, hex, bin
 from i18n import _
-import scmutil, util, filemerge, copies, subrepo, encoding
+import scmutil, util, filemerge, copies, subrepo
 import errno, os, shutil
 
 class mergestate(object):
@@ -100,7 +100,7 @@
     "check for case folding collisions in the destination context"
     folded = {}
     for fn in mctx:
-        fold = encoding.lower(fn)
+        fold = util.normcase(fn)
         if fold in folded:
             raise util.Abort(_("case-folding collision between %s and %s")
                              % (fn, folded[fold]))
diff -r 3145a0ba21af -r 7ef5cd9f4a55 mercurial/windows.py
--- a/mercurial/windows.py	Mon Dec 12 17:10:19 2011 +0900
+++ b/mercurial/windows.py	Mon Dec 12 17:10:19 2011 +0900
@@ -140,7 +140,7 @@
     '''
     # TODO: There may be a more clever way to do this that also handles other,
     # less common file systems.
-    return os.path.normpath(os.path.normcase(os.path.realpath(path)))
+    return os.path.normpath(normcase(os.path.realpath(path)))
 
 def samestat(s1, s2):
     return False
@@ -216,17 +216,16 @@
 def statfiles(files):
     '''Stat each file in files and yield stat or None if file does not exist.
     Cluster and cache stat per directory to minimize number of OS stat calls.'''
-    ncase = os.path.normcase
     dircache = {} # dirname -> filename -> status | None if file does not exist
     for nf in files:
-        nf  = ncase(nf)
+        nf  = normcase(nf)
         dir, base = os.path.split(nf)
         if not dir:
             dir = '.'
         cache = dircache.get(dir, None)
         if cache is None:
             try:
-                dmap = dict([(ncase(n), s)
+                dmap = dict([(normcase(n), s)
                     for n, k, s in osutil.listdir(dir, True)])
             except OSError, err:
                 # handle directory not found in Python version prior to 2.5


More information about the Mercurial-devel mailing list