Patchwork [4,of,5] py3: make test-extdiff.t pass on Python 3

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 17, 2018, 10:07 a.m.
Message ID <320a41b6eba2532ffbcf.1518862059@mimosa>
Download mbox | patch
Permalink /patch/28024/
State Accepted
Headers show

Comments

Yuya Nishihara - Feb. 17, 2018, 10:07 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1518859215 -32400
#      Sat Feb 17 18:20:15 2018 +0900
# Node ID 320a41b6eba2532ffbcf2aaa50ec73ecb00f06d4
# Parent  d21d2aee7b586eb509bee6c8577efc00fed467f6
py3: make test-extdiff.t pass on Python 3

Patch

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -88,6 +88,7 @@  test-exchange-obsmarkers-case-D2.t
 test-exchange-obsmarkers-case-D3.t
 test-exchange-obsmarkers-case-D4.t
 test-execute-bit.t
+test-extdiff.t
 test-extra-filelog-entry.t
 test-filebranch.t
 test-flags.t
diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -285,7 +285,7 @@  def dodiff(ui, repo, cmdline, pats, opts
             cmdline += ' $parent1 $child'
         cmdline = re.sub(regex, quote, cmdline)
 
-        ui.debug('running %r in %s\n' % (cmdline, tmproot))
+        ui.debug('running %r in %s\n' % (pycompat.bytestr(cmdline), tmproot))
         ui.system(cmdline, cwd=tmproot, blockedtag='extdiff')
 
         for copy_fn, working_fn, st in fnsandstat:
diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -424,7 +424,8 @@  Test symlinks handling (issue1909)
 
 Test handling of non-ASCII paths in generated docstrings (issue5301)
 
-  >>> open("u", "w").write("\xa5\xa5")
+  >>> with open("u", "wb") as f:
+  ...     n = f.write(b"\xa5\xa5")
   $ U=`cat u`
 
   $ HGPLAIN=1 hg --config hgext.extdiff= --config extdiff.cmd.td=hi help -k xyzzy