comparison mercurial/extensions.py @ 31447:067add650129

encoding: factor out unicode variants of from/tolocal() Unfortunately, these functions will be commonly used on Python 3.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 13 Mar 2017 09:11:08 -0700
parents 90f439823b99
children 6419cd243017
comparison
equal deleted inserted replaced
31446:9a94239e4f12 31447:067add650129
107 107
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 if pycompat.ispy3:
112 return encoding.tolocal(str(inst).encode('utf-8')) 112 return encoding.unitolocal(str(inst))
113 return inst 113 return inst
114 114
115 def _reportimporterror(ui, err, failed, next): 115 def _reportimporterror(ui, err, failed, next):
116 # note: this ui.debug happens before --debug is processed, 116 # note: this ui.debug happens before --debug is processed,
117 # Use --config ui.debug=1 to see them. 117 # Use --config ui.debug=1 to see them.