changeset 28725:3cf1995dbdd5

py3: use print_function in generate-working-copy-states.py
author Robert Stanca <robert.stanca7@gmail.com>
date Sat, 02 Apr 2016 17:36:59 +0300
parents cf339d6ac7c7
children f4b31fcd5e72
files tests/generate-working-copy-states.py tests/test-check-py3-compat.t
diffstat 2 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tests/generate-working-copy-states.py	Sat Apr 02 17:35:02 2016 +0300
+++ b/tests/generate-working-copy-states.py	Sat Apr 02 17:36:59 2016 +0300
@@ -29,7 +29,7 @@
 # $ hg forget *_*_*-untracked
 # $ rm *_*_missing-*
 
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 
 import os
 import sys
@@ -66,7 +66,7 @@
 content = []
 for filename, states in combinations:
     if target == 'filelist':
-        print filename
+        print(filename)
     elif target == 'state':
         if depth == 'wc':
             # Make sure there is content so the file gets written and can be
@@ -75,7 +75,7 @@
         else:
             content.append((filename, states[int(depth) - 1]))
     else:
-        print >> sys.stderr, "unknown target:", target
+        print("unknown target:", target, file=sys.stderr)
         sys.exit(1)
 
 # write actual content
--- a/tests/test-check-py3-compat.t	Sat Apr 02 17:35:02 2016 +0300
+++ b/tests/test-check-py3-compat.t	Sat Apr 02 17:36:59 2016 +0300
@@ -40,7 +40,6 @@
   i18n/check-translation.py not using absolute_import
   i18n/polib.py not using absolute_import
   setup.py not using absolute_import
-  tests/generate-working-copy-states.py requires print_function
   tests/get-with-headers.py requires print_function
   tests/heredoctest.py requires print_function
   tests/hypothesishelpers.py not using absolute_import
@@ -258,7 +257,6 @@
   mercurial/win*.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob)
   mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
   mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
-  tests/generate-working-copy-states.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
   tests/get-with-headers.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
   tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/silenttestrunner.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)