Mercurial > public > mercurial-scm > hg
comparison mercurial/posix.py @ 15672:2ebe3d0ce91d stable
i18n: use encoding.lower/upper for encoding aware case folding
this patch uses encoding.lower/upper for case folding, because ones of
str can not fold case of non ascii characters correctly.
to avoid cyclic dependency and to encapsulate logic of normcase in
each platforms, this patch introduces encodinglower/encodingupper in
both posix/windows specific files.
this patch does not change implementation of normcase() in posix.py,
because we do not know the encoding of filenames on POSIX.
some "normcase()" are excluded from function wrap list in
hgext/win32mbcs.py, because they become encoding aware by this patch.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 16 Dec 2011 21:09:41 +0900 |
parents | b61fa7481a68 |
children | c51c9dc13a58 |
comparison
equal
deleted
inserted
replaced
15671:3c5e818ac679 | 15672:2ebe3d0ce91d |
---|---|
162 guaranteed to work for files, not directories.""" | 162 guaranteed to work for files, not directories.""" |
163 st1 = os.lstat(fpath1) | 163 st1 = os.lstat(fpath1) |
164 st2 = os.lstat(fpath2) | 164 st2 = os.lstat(fpath2) |
165 return st1.st_dev == st2.st_dev | 165 return st1.st_dev == st2.st_dev |
166 | 166 |
167 encodinglower = None | |
168 encodingupper = None | |
169 | |
167 # os.path.normcase is a no-op, which doesn't help us on non-native filesystems | 170 # os.path.normcase is a no-op, which doesn't help us on non-native filesystems |
168 def normcase(path): | 171 def normcase(path): |
169 return path.lower() | 172 return path.lower() |
170 | 173 |
171 if sys.platform == 'darwin': | 174 if sys.platform == 'darwin': |