Show More
@@ -204,6 +204,16 b' def unifromlocal(s):' | |||||
204 | """Convert a byte string of local encoding to a unicode string""" |
|
204 | """Convert a byte string of local encoding to a unicode string""" | |
205 | return fromlocal(s).decode('utf-8') |
|
205 | return fromlocal(s).decode('utf-8') | |
206 |
|
206 | |||
|
207 | # converter functions between native str and byte string. use these if the | |||
|
208 | # character encoding is not aware (e.g. exception message) or is known to | |||
|
209 | # be locale dependent (e.g. date formatting.) | |||
|
210 | if pycompat.ispy3: | |||
|
211 | strtolocal = unitolocal | |||
|
212 | strfromlocal = unifromlocal | |||
|
213 | else: | |||
|
214 | strtolocal = str | |||
|
215 | strfromlocal = str | |||
|
216 | ||||
207 | if not _nativeenviron: |
|
217 | if not _nativeenviron: | |
208 | # now encoding and helper functions are available, recreate the environ |
|
218 | # now encoding and helper functions are available, recreate the environ | |
209 | # dict to be exported to other modules |
|
219 | # dict to be exported to other modules |
@@ -108,9 +108,7 b' def _importext(name, path=None, reportfu' | |||||
108 | def _forbytes(inst): |
|
108 | def _forbytes(inst): | |
109 | """Portably format an import error into a form suitable for |
|
109 | """Portably format an import error into a form suitable for | |
110 | %-formatting into bytestrings.""" |
|
110 | %-formatting into bytestrings.""" | |
111 | if pycompat.ispy3: |
|
111 | return encoding.strtolocal(str(inst)) | |
112 | return encoding.unitolocal(str(inst)) |
|
|||
113 | return inst |
|
|||
114 |
|
112 | |||
115 | def _reportimporterror(ui, err, failed, next): |
|
113 | def _reportimporterror(ui, err, failed, next): | |
116 | # note: this ui.debug happens before --debug is processed, |
|
114 | # note: this ui.debug happens before --debug is processed, |
@@ -2653,9 +2653,7 b' class url(object):' | |||||
2653 | >>> print url(r'file:///D:\data\hg') |
|
2653 | >>> print url(r'file:///D:\data\hg') | |
2654 | file:///D:\data\hg |
|
2654 | file:///D:\data\hg | |
2655 | """ |
|
2655 | """ | |
2656 | if pycompat.ispy3: |
|
2656 | return encoding.strfromlocal(self.__bytes__()) | |
2657 | return encoding.unifromlocal(self.__bytes__()) |
|
|||
2658 | return self.__bytes__() |
|
|||
2659 |
|
2657 | |||
2660 | def __bytes__(self): |
|
2658 | def __bytes__(self): | |
2661 | if self._localpath: |
|
2659 | if self._localpath: |
@@ -22,7 +22,7 b' New errors are not allowed. Warnings are' | |||||
22 | mercurial/encoding.py:61: |
|
22 | mercurial/encoding.py:61: | |
23 | > for k, v in os.environ.items()) |
|
23 | > for k, v in os.environ.items()) | |
24 | use encoding.environ instead (py3) |
|
24 | use encoding.environ instead (py3) | |
25 |
mercurial/encoding.py:2 |
|
25 | mercurial/encoding.py:221: | |
26 | > for k, v in os.environ.items()) |
|
26 | > for k, v in os.environ.items()) | |
27 | use encoding.environ instead (py3) |
|
27 | use encoding.environ instead (py3) | |
28 | Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob) |
|
28 | Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob) |
General Comments 0
You need to be logged in to leave comments.
Login now