changeset 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 f0124a65e8f8
children 68eecbaf1bd3
files mercurial/posix.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Tue Jan 29 20:03:51 2013 +0100
+++ b/mercurial/posix.py	Tue Jan 29 17:01:41 2013 +0100
@@ -195,6 +195,11 @@
 
     def normcase(path):
         try:
+            path.decode('ascii') # throw exception for non-ASCII character
+            return path.lower()
+        except UnicodeDecodeError:
+            pass
+        try:
             u = path.decode('utf-8')
         except UnicodeDecodeError:
             # percent-encode any characters that don't round-trip