Mercurial > hg
changeset 37622:bfdd20d22a86
py3: make sure decode() first argument is str
Uses pycompat.sysstr() to make sure we uses bytes on Python 2 and unicodes on
Python 3.
Differential Revision: https://phab.mercurial-scm.org/D3279
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 12 Apr 2018 15:05:49 +0530 |
parents | 5537d8f5e989 |
children | eb687c28a915 |
files | hgext/convert/common.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/common.py Thu Apr 12 23:14:38 2018 -0700 +++ b/hgext/convert/common.py Thu Apr 12 15:05:49 2018 +0530 @@ -217,12 +217,13 @@ if isinstance(s, unicode): return s.encode("utf-8") try: - return s.decode(encoding).encode("utf-8") + return s.decode(pycompat.sysstr(encoding)).encode("utf-8") except UnicodeError: try: return s.decode("latin-1").encode("utf-8") except UnicodeError: - return s.decode(encoding, "replace").encode("utf-8") + return s.decode(pycompat.sysstr(encoding), + "replace").encode("utf-8") def getchangedfiles(self, rev, i): """Return the files changed by rev compared to parent[i].