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
--- 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].