convert: do not try to re-encode in python3

Summary: The encoding is utf-8 already.

Reviewed By: sfilipco

Differential Revision: D20966808

fbshipit-source-id: ade012588bf14df07772db0819be8670ecdb3b09
This commit is contained in:
Xavier Deguillard 2020-04-13 08:50:39 -07:00 committed by Facebook GitHub Bot
parent aa836d38ea
commit cdb0fbdb71
7 changed files with 7 additions and 15 deletions

View File

@ -14,6 +14,7 @@ from __future__ import absolute_import
import os
import shlex
import shutil
import sys
from edenscm.hgext.convert.repo import repo_source
from edenscm.mercurial import encoding, error, hg, progress, pycompat, scmutil, util
@ -39,10 +40,13 @@ orig_encoding = "ascii"
def recode(s):
if isinstance(s, pycompat.unicode):
return s.encode(orig_encoding, "replace")
if sys.version_info[0] < 3:
if isinstance(s, pycompat.unicode):
return s.encode(orig_encoding, "replace")
else:
return s.decode("utf-8").encode(orig_encoding, "replace")
else:
return s.decode("utf-8").encode(orig_encoding, "replace")
return s
def mapbranch(branch, branchmap):

View File

@ -9,9 +9,6 @@ from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
feature.require(["py2"])
sh % ". helpers-usechg.sh"
sh % "cat" << r"""

View File

@ -9,9 +9,6 @@ from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
feature.require(["py2"])
sh % ". helpers-usechg.sh"
sh % "setconfig 'ui.allowemptycommit=1'"

View File

@ -1,4 +1,3 @@
#require py2
#chg-compatible
#require execbit

View File

@ -1,4 +1,3 @@
#require py2
#chg-compatible
$ disable treemanifest

View File

@ -1,4 +1,3 @@
#require py2
#chg-compatible
$ disable treemanifest

View File

@ -8,9 +8,6 @@ from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
feature.require(["py2"])
sh % "setconfig 'extensions.treemanifest=!'"
# Set up extension and repos