Patchwork D2221: convcmd: pass encoding name as a sysstr

login
register
mail settings
Submitter phabricator
Date Feb. 13, 2018, 5:06 a.m.
Message ID <differential-rev-PHID-DREV-5clv2i7x365suaqt6ixk-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27800/
State Superseded
Headers show

Comments

phabricator - Feb. 13, 2018, 5:06 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2221

AFFECTED FILES
  hgext/convert/convcmd.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -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):
     '''