##// END OF EJS Templates
icasefs: use util.normcase() instead of str.lower() or os.path.normpath()
FUJIWARA Katsunori -
r15637:7f01ad70 stable
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7
7
8 from node import nullid, nullrev, hex, bin
8 from node import nullid, nullrev, hex, bin
9 from i18n import _
9 from i18n import _
10 import scmutil, util, filemerge, copies, subrepo, encoding
10 import scmutil, util, filemerge, copies, subrepo
11 import errno, os, shutil
11 import errno, os, shutil
12
12
13 class mergestate(object):
13 class mergestate(object):
@@ -100,7 +100,7 b' def _checkcollision(mctx):'
100 "check for case folding collisions in the destination context"
100 "check for case folding collisions in the destination context"
101 folded = {}
101 folded = {}
102 for fn in mctx:
102 for fn in mctx:
103 fold = encoding.lower(fn)
103 fold = util.normcase(fn)
104 if fold in folded:
104 if fold in folded:
105 raise util.Abort(_("case-folding collision between %s and %s")
105 raise util.Abort(_("case-folding collision between %s and %s")
106 % (fn, folded[fold]))
106 % (fn, folded[fold]))
@@ -140,7 +140,7 b' def realpath(path):'
140 '''
140 '''
141 # TODO: There may be a more clever way to do this that also handles other,
141 # TODO: There may be a more clever way to do this that also handles other,
142 # less common file systems.
142 # less common file systems.
143 return os.path.normpath(os.path.normcase(os.path.realpath(path)))
143 return os.path.normpath(normcase(os.path.realpath(path)))
144
144
145 def samestat(s1, s2):
145 def samestat(s1, s2):
146 return False
146 return False
@@ -216,17 +216,16 b' def findexe(command):'
216 def statfiles(files):
216 def statfiles(files):
217 '''Stat each file in files and yield stat or None if file does not exist.
217 '''Stat each file in files and yield stat or None if file does not exist.
218 Cluster and cache stat per directory to minimize number of OS stat calls.'''
218 Cluster and cache stat per directory to minimize number of OS stat calls.'''
219 ncase = os.path.normcase
220 dircache = {} # dirname -> filename -> status | None if file does not exist
219 dircache = {} # dirname -> filename -> status | None if file does not exist
221 for nf in files:
220 for nf in files:
222 nf = ncase(nf)
221 nf = normcase(nf)
223 dir, base = os.path.split(nf)
222 dir, base = os.path.split(nf)
224 if not dir:
223 if not dir:
225 dir = '.'
224 dir = '.'
226 cache = dircache.get(dir, None)
225 cache = dircache.get(dir, None)
227 if cache is None:
226 if cache is None:
228 try:
227 try:
229 dmap = dict([(ncase(n), s)
228 dmap = dict([(normcase(n), s)
230 for n, k, s in osutil.listdir(dir, True)])
229 for n, k, s in osutil.listdir(dir, True)])
231 except OSError, err:
230 except OSError, err:
232 # handle directory not found in Python version prior to 2.5
231 # handle directory not found in Python version prior to 2.5
General Comments 0
You need to be logged in to leave comments. Login now