--- a/mercurial/encoding.py Mon Jul 31 23:40:36 2017 +0900
+++ b/mercurial/encoding.py Mon Jul 31 23:13:47 2017 +0900
@@ -18,6 +18,11 @@
pycompat,
)
+charencode = policy.importmod(r'charencode')
+
+asciilower = charencode.asciilower
+asciiupper = charencode.asciiupper
+
_sysstr = pycompat.sysstr
if pycompat.ispy3:
@@ -318,38 +323,6 @@
return concat(usub.encode(_sysstr(encoding)))
return ellipsis # no enough room for multi-column characters
-def _asciilower(s):
- '''convert a string to lowercase if ASCII
-
- Raises UnicodeDecodeError if non-ASCII characters are found.'''
- s.decode('ascii')
- return s.lower()
-
-def asciilower(s):
- # delay importing avoids cyclic dependency around "parsers" in
- # pure Python build (util => i18n => encoding => parsers => util)
- parsers = policy.importmod(r'parsers')
- impl = getattr(parsers, 'asciilower', _asciilower)
- global asciilower
- asciilower = impl
- return impl(s)
-
-def _asciiupper(s):
- '''convert a string to uppercase if ASCII
-
- Raises UnicodeDecodeError if non-ASCII characters are found.'''
- s.decode('ascii')
- return s.upper()
-
-def asciiupper(s):
- # delay importing avoids cyclic dependency around "parsers" in
- # pure Python build (util => i18n => encoding => parsers => util)
- parsers = policy.importmod(r'parsers')
- impl = getattr(parsers, 'asciiupper', _asciiupper)
- global asciiupper
- asciiupper = impl
- return impl(s)
-
def lower(s):
"best-effort encoding-aware case-folding of local string s"
try: