diff mercurial/scmutil.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 6ed2a449cb5b
children cc2c22511707
line wrap: on
line diff
--- a/mercurial/scmutil.py	Fri Jul 22 20:31:15 2011 -0300
+++ b/mercurial/scmutil.py	Thu Jul 28 14:36:07 2011 +0900
@@ -6,7 +6,7 @@
 # GNU General Public License version 2 or any later version.
 
 from i18n import _
-import util, error, osutil, revset, similar
+import util, error, osutil, revset, similar, encoding
 import match as matchmod
 import os, errno, re, stat, sys, glob
 
@@ -46,10 +46,10 @@
         self._abort = abort
         self._map = {}
         for f in existingiter:
-            self._map[f.lower()] = f
+            self._map[encoding.lower(f)] = f
 
     def __call__(self, f):
-        fl = f.lower()
+        fl = encoding.lower(f)
         map = self._map
         if fl in map and map[fl] != f:
             msg = _('possible case-folding collision for %s') % f