D3633: py3: use bytes in tests/printenv.py
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Sun May 20 12:24:47 UTC 2018
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This patch add b'' prefixes and adds some .encode() calls to convert str to
bytes on Python 3.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3633
AFFECTED FILES
tests/printenv.py
CHANGE DETAILS
diff --git a/tests/printenv.py b/tests/printenv.py
--- a/tests/printenv.py
+++ b/tests/printenv.py
@@ -39,14 +39,15 @@
if k.startswith("HG_") and v]
env.sort()
-out.write("%s hook: " % name)
+out.write(b"%s hook: " % name.encode('ascii'))
if os.name == 'nt':
filter = lambda x: x.replace('\\', '/')
else:
filter = lambda x: x
-vars = ["%s=%s" % (k, filter(v)) for k, v in env]
-out.write(" ".join(vars))
-out.write("\n")
+vars = [b"%s=%s" % (k.encode('ascii'), filter(v).encode('ascii'))
+ for k, v in env]
+out.write(b" ".join(vars))
+out.write(b"\n")
out.close()
sys.exit(exitcode)
To: pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list