diff mercurial/posix.py @ 24803:e89f909edffa stable 3.4-rc

merge default into stable for 3.4 freeze
author Matt Mackall <mpm@selenic.com>
date Thu, 16 Apr 2015 20:57:51 -0500
parents 144883a8d0d4
children c2ec81891502
line wrap: on
line diff
--- a/mercurial/posix.py	Thu Apr 16 22:33:53 2015 +0900
+++ b/mercurial/posix.py	Thu Apr 16 20:57:51 2015 -0500
@@ -16,6 +16,7 @@
 oslink = os.link
 unlink = os.unlink
 rename = os.rename
+removedirs = os.removedirs
 expandglobs = False
 
 umask = os.umask(0)
@@ -200,6 +201,11 @@
 def normcase(path):
     return path.lower()
 
+# what normcase does to ASCII strings
+normcasespec = encoding.normcasespecs.lower
+# fallback normcase function for non-ASCII strings
+normcasefallback = normcase
+
 if sys.platform == 'darwin':
 
     def normcase(path):
@@ -223,7 +229,11 @@
         try:
             return encoding.asciilower(path)  # exception for non-ASCII
         except UnicodeDecodeError:
-            pass
+            return normcasefallback(path)
+
+    normcasespec = encoding.normcasespecs.lower
+
+    def normcasefallback(path):
         try:
             u = path.decode('utf-8')
         except UnicodeDecodeError:
@@ -302,6 +312,9 @@
 
         return encoding.upper(path)
 
+    normcasespec = encoding.normcasespecs.other
+    normcasefallback = normcase
+
     # Cygwin translates native ACLs to POSIX permissions,
     # but these translations are not supported by native
     # tools, so the exec bit tends to be set erroneously.