Mercurial > hg
changeset 31338:a9a28ca17615
util: pass encoding.[encoding|encodingmode] as unicodes
We need to pass str to encode() and decode().
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 12 Mar 2017 07:35:13 +0530 |
parents | ec7831675867 |
children | 7c09b071318a |
files | mercurial/util.py |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Wed Mar 08 16:52:57 2017 -0800 +++ b/mercurial/util.py Sun Mar 12 07:35:13 2017 +0530 @@ -2241,13 +2241,16 @@ if width <= maxindent: # adjust for weird terminal size width = max(78, maxindent + 1) - line = line.decode(encoding.encoding, encoding.encodingmode) - initindent = initindent.decode(encoding.encoding, encoding.encodingmode) - hangindent = hangindent.decode(encoding.encoding, encoding.encodingmode) + line = line.decode(pycompat.sysstr(encoding.encoding), + pycompat.sysstr(encoding.encodingmode)) + initindent = initindent.decode(pycompat.sysstr(encoding.encoding), + pycompat.sysstr(encoding.encodingmode)) + hangindent = hangindent.decode(pycompat.sysstr(encoding.encoding), + pycompat.sysstr(encoding.encodingmode)) wrapper = MBTextWrapper(width=width, initial_indent=initindent, subsequent_indent=hangindent) - return wrapper.fill(line).encode(encoding.encoding) + return wrapper.fill(line).encode(pycompat.sysstr(encoding.encoding)) if (pyplatform.python_implementation() == 'CPython' and sys.version_info < (3, 0)):