Mercurial > public > mercurial-scm > hg
comparison mercurial/posix.py @ 18501:a3b2dc1aa909 stable
OS X: try cheap ascii .lower() in normcase before making full unicode dance
This is similar to what is done in encoding.lower, introduced in c481761033bd.
This has been seen making 'hg up' and 'hg st' in a 50000+ files repo 13%
faster.
This might make Mercurial slightly slower for users who mainly use non-ASCII
filenames. That is a reasonable trade-off.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 29 Jan 2013 17:01:41 +0100 |
parents | ecba9b0e7672 |
children | cafa447a7d3b |
comparison
equal
deleted
inserted
replaced
18500:f0124a65e8f8 | 18501:a3b2dc1aa909 |
---|---|
193 if sys.platform == 'darwin': | 193 if sys.platform == 'darwin': |
194 import fcntl # only needed on darwin, missing on jython | 194 import fcntl # only needed on darwin, missing on jython |
195 | 195 |
196 def normcase(path): | 196 def normcase(path): |
197 try: | 197 try: |
198 path.decode('ascii') # throw exception for non-ASCII character | |
199 return path.lower() | |
200 except UnicodeDecodeError: | |
201 pass | |
202 try: | |
198 u = path.decode('utf-8') | 203 u = path.decode('utf-8') |
199 except UnicodeDecodeError: | 204 except UnicodeDecodeError: |
200 # percent-encode any characters that don't round-trip | 205 # percent-encode any characters that don't round-trip |
201 p2 = path.decode('utf-8', 'ignore').encode('utf-8') | 206 p2 = path.decode('utf-8', 'ignore').encode('utf-8') |
202 s = "" | 207 s = "" |