convcmd: pass encoding name as a sysstr
authorAugie Fackler <augie@google.com>
Mon, 12 Feb 2018 23:51:18 -0500
changeset 36133 6df206ef4b10
parent 36132 42a393ea56d2
child 36134 2a28bdb63f05
convcmd: pass encoding name as a sysstr Differential Revision: https://phab.mercurial-scm.org/D2221
hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py	Mon Feb 12 23:50:58 2018 -0500
+++ b/hgext/convert/convcmd.py	Mon Feb 12 23:51:18 2018 -0500
@@ -16,6 +16,7 @@
     encoding,
     error,
     hg,
+    pycompat,
     scmutil,
     util,
 )
@@ -55,9 +56,10 @@
 
 def recode(s):
     if isinstance(s, unicode):
-        return s.encode(orig_encoding, 'replace')
+        return s.encode(pycompat.sysstr(orig_encoding), 'replace')
     else:
-        return s.decode('utf-8').encode(orig_encoding, 'replace')
+        return s.decode('utf-8').encode(
+            pycompat.sysstr(orig_encoding), 'replace')
 
 def mapbranch(branch, branchmap):
     '''