comparison mercurial/merge.py @ 14980:28e98a8b173d stable

i18n: use UTF-8 string to lower filename for case collision check Some character sets, cp932 (known as Shift-JIS for Japanese) for example, use 0x41('A') - 0x5A('Z') and 0x61('a') - 0x7A('z') as second or later character. In such character set, case collision checking recognizes different files as CASEFOLDED same file, if filenames are treated as byte sequence. win32mbcs extension is not appropriate to handle this problem, because this problem can occur on other than Windows platform only if problematic character set is used. Callers of util.checkcase() use known ASCII filenames as last component of path, and string.lower() is not applied to directory part of path. So, util.checkcase() is kept intact, even though it applies string.lower() to filenames.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 28 Jul 2011 14:36:07 +0900
parents 88cb01c4575e
children 3afe5edda4e3
comparison
equal deleted inserted replaced
14920:56848e2bb0c5 14980:28e98a8b173d
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
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 10 import scmutil, util, filemerge, copies, subrepo, encoding
11 import errno, os, shutil 11 import errno, os, shutil
12 12
13 class mergestate(object): 13 class mergestate(object):
14 '''track 3-way merge state of individual files''' 14 '''track 3-way merge state of individual files'''
15 def __init__(self, repo): 15 def __init__(self, repo):
90 90
91 def _checkcollision(mctx): 91 def _checkcollision(mctx):
92 "check for case folding collisions in the destination context" 92 "check for case folding collisions in the destination context"
93 folded = {} 93 folded = {}
94 for fn in mctx: 94 for fn in mctx:
95 fold = fn.lower() 95 fold = encoding.lower(fn)
96 if fold in folded: 96 if fold in folded:
97 raise util.Abort(_("case-folding collision between %s and %s") 97 raise util.Abort(_("case-folding collision between %s and %s")
98 % (fn, folded[fold])) 98 % (fn, folded[fold]))
99 folded[fold] = fn 99 folded[fold] = fn
100 100