Patchwork D3218: py3: use print as a function in test-mq-qpush-fail.t

login
register
mail settings
Submitter phabricator
Date April 10, 2018, 2:15 p.m.
Message ID <differential-rev-PHID-DREV-zf52jujp2kgukg6k4yew-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30627/
State Superseded
Headers show

Comments

phabricator - April 10, 2018, 2:15 p.m.
pulkit 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/D3218

AFFECTED FILES
  tests/test-mq-qpush-fail.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - April 10, 2018, 3:20 p.m.
yuja requested changes to this revision.
yuja added a comment.
This revision now requires changes to proceed.


  `print(nonascii)` may fail depending on the locale.
  We have to use `getattr(sys.stdout, 'buffer', sys.stdout)` or `pycompat.stdout`.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
phabricator - April 11, 2018, 9:19 a.m.
pulkit added a comment.


  In https://phab.mercurial-scm.org/D3218#51610, @yuja wrote:
  
  > `print(nonascii)` may fail depending on the locale.
  >  We have to use `getattr(sys.stdout, 'buffer', sys.stdout)` or `pycompat.stdout`.
  
  
  I get the following failure:
  
    --- /home/foobar/repo/hg-committed/tests/test-mq-qpush-fail.t
    +++ /home/foobar/repo/hg-committed/tests/test-mq-qpush-fail.t.err
    @@ -60,7 +60,7 @@
       cleaning up working directory...
       reverting foo
       done
    -  abort: decoding near '\xe9': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)! (esc)
    +  abort: decoding near '\xe9From: tes': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)! (esc)
       [255]
       $ hg parents
       changeset:   0:bbd179dfa0a7
  
  I see that you advised same on https://phab.mercurial-scm.org/D2334 and I got the above failure that time too and was unable to followup. Any ideas on this failure? I tried `stdout.flush()` too.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
phabricator - April 11, 2018, 11:06 a.m.
yuja added a comment.


  Maybe you didn't add "\n".

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
phabricator - April 11, 2018, 11:21 a.m.
pulkit added a comment.


  In https://phab.mercurial-scm.org/D3218#51878, @yuja wrote:
  
  > Maybe you didn't add "\n".
  
  
  Yep, I didn't add "\n". Thanks a lot!

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
phabricator - April 11, 2018, 11:49 a.m.
yuja added a comment.


  Queued, thanks. I've dropped unneeded flush(), and added b''.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel

Patch

diff --git a/tests/test-mq-qpush-fail.t b/tests/test-mq-qpush-fail.t
--- a/tests/test-mq-qpush-fail.t
+++ b/tests/test-mq-qpush-fail.t
@@ -31,7 +31,7 @@ 
   popping patch2
   popping patch1
   patch queue now empty
-  $ $PYTHON -c 'print "\xe9"' > message
+  $ $PYTHON -c 'from __future__ import print_function; print("\xe9")' > message
   $ cat .hg/patches/bad-patch >> message
   $ mv message .hg/patches/bad-patch
   $ cat > $TESTTMP/wrapplayback.py <<EOF