Show More
@@ -128,8 +128,6 b' def wrapname(name, wrapper):' | |||||
128 | # they use result of os.path.split() |
|
128 | # they use result of os.path.split() | |
129 | funcs = '''os.path.join os.path.split os.path.splitext |
|
129 | funcs = '''os.path.join os.path.split os.path.splitext | |
130 | os.path.splitunc os.path.normpath os.makedirs |
|
130 | os.path.splitunc os.path.normpath os.makedirs | |
131 | mercurial.windows.normcase |
|
|||
132 | mercurial.util.normcase |
|
|||
133 | mercurial.util.endswithsep mercurial.util.splitpath mercurial.util.checkcase |
|
131 | mercurial.util.endswithsep mercurial.util.splitpath mercurial.util.checkcase | |
134 | mercurial.util.fspath mercurial.util.pconvert mercurial.util.normpath |
|
132 | mercurial.util.fspath mercurial.util.pconvert mercurial.util.normpath | |
135 | mercurial.util.checkwinfilename mercurial.util.checkosfilename''' |
|
133 | mercurial.util.checkwinfilename mercurial.util.checkosfilename''' |
@@ -171,3 +171,22 b' def lower(s):' | |||||
171 | return lu.encode(encoding) |
|
171 | return lu.encode(encoding) | |
172 | except UnicodeError: |
|
172 | except UnicodeError: | |
173 | return s.lower() # we don't know how to fold this except in ASCII |
|
173 | return s.lower() # we don't know how to fold this except in ASCII | |
|
174 | except LookupError, k: | |||
|
175 | raise error.Abort(k, hint="please check your locale settings") | |||
|
176 | ||||
|
177 | def upper(s): | |||
|
178 | "best-effort encoding-aware case-folding of local string s" | |||
|
179 | try: | |||
|
180 | if isinstance(s, localstr): | |||
|
181 | u = s._utf8.decode("utf-8") | |||
|
182 | else: | |||
|
183 | u = s.decode(encoding, encodingmode) | |||
|
184 | ||||
|
185 | uu = u.upper() | |||
|
186 | if u == uu: | |||
|
187 | return s # preserve localstring | |||
|
188 | return uu.encode(encoding) | |||
|
189 | except UnicodeError: | |||
|
190 | return s.upper() # we don't know how to fold this except in ASCII | |||
|
191 | except LookupError, k: | |||
|
192 | raise error.Abort(k, hint="please check your locale settings") |
@@ -164,6 +164,9 b' def samedevice(fpath1, fpath2):' | |||||
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() |
@@ -24,6 +24,9 b" if os.name == 'nt':" | |||||
24 | else: |
|
24 | else: | |
25 | import posix as platform |
|
25 | import posix as platform | |
26 |
|
26 | |||
|
27 | platform.encodinglower = encoding.lower | |||
|
28 | platform.encodingupper = encoding.upper | |||
|
29 | ||||
27 | cachestat = platform.cachestat |
|
30 | cachestat = platform.cachestat | |
28 | checkexec = platform.checkexec |
|
31 | checkexec = platform.checkexec | |
29 | checklink = platform.checklink |
|
32 | checklink = platform.checklink |
@@ -131,8 +131,11 b' def localpath(path):' | |||||
131 | def normpath(path): |
|
131 | def normpath(path): | |
132 | return pconvert(os.path.normpath(path)) |
|
132 | return pconvert(os.path.normpath(path)) | |
133 |
|
133 | |||
|
134 | encodinglower = None | |||
|
135 | encodingupper = None | |||
|
136 | ||||
134 | def normcase(path): |
|
137 | def normcase(path): | |
135 |
return path |
|
138 | return encodingupper(path) | |
136 |
|
139 | |||
137 | def realpath(path): |
|
140 | def realpath(path): | |
138 | ''' |
|
141 | ''' |
General Comments 0
You need to be logged in to leave comments.
Login now