D294: tests: clean up many print statements to be print functions instead

2017-08-09 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG24849d53697d: tests: clean up many print statements to be 
print functions instead (authored by durin42).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D294?vs=677=689

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

AFFECTED FILES
  tests/test-commit-interactive-curses.t
  tests/test-commit-multiple.t
  tests/test-contrib-check-code.t
  tests/test-convert-cvs.t
  tests/test-eol.t
  tests/test-extension.t
  tests/test-filebranch.t
  tests/test-glog.t
  tests/test-hardlinks.t
  tests/test-help.t
  tests/test-hook.t
  tests/test-inherit-mode.t
  tests/test-issue4074.t
  tests/test-largefiles-cache.t
  tests/test-log.t
  tests/test-merge-symlinks.t
  tests/test-merge1.t
  tests/test-merge6.t
  tests/test-mq-eol.t
  tests/test-notify-changegroup.t

CHANGE DETAILS

diff --git a/tests/test-notify-changegroup.t b/tests/test-notify-changegroup.t
--- a/tests/test-notify-changegroup.t
+++ b/tests/test-notify-changegroup.t
@@ -39,7 +39,7 @@
 push
 
   $ hg --traceback --cwd b push ../a 2>&1 |
-  > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", 
sys.stdin.read()),'
+  > $PYTHON -c 'from __future__ import print_function ; import sys,re; 
print(re.sub("\n\t", " ", sys.stdin.read()), end="")'
   pushing to ../a
   searching for changes
   adding changesets
@@ -92,7 +92,7 @@
 unbundle with correct source
 
   $ hg --config notify.sources=unbundle --cwd a unbundle ../test.hg 2>&1 |
-  > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", 
sys.stdin.read()),'
+  > $PYTHON -c 'from __future__ import print_function ; import sys,re; 
print(re.sub("\n\t", " ", sys.stdin.read()), end="")'
   adding changesets
   adding manifests
   adding file changes
@@ -167,7 +167,7 @@
 push
 
   $ hg --traceback --cwd b --config notify.fromauthor=True push ../a 2>&1 |
-  > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", 
sys.stdin.read()),'
+  > $PYTHON -c 'from __future__ import print_function ; import sys,re; 
print(re.sub("\n\t", " ", sys.stdin.read()), end="")'
   pushing to ../a
   searching for changes
   adding changesets
diff --git a/tests/test-mq-eol.t b/tests/test-mq-eol.t
--- a/tests/test-mq-eol.t
+++ b/tests/test-mq-eol.t
@@ -33,7 +33,7 @@
   > for line in file(sys.argv[1], 'rb'):
   > line = line.replace('\r', '')
   > line = line.replace('\n', '')
-  > print line
+  > print(line)
   > EOF
 
   $ hg init repo
diff --git a/tests/test-merge6.t b/tests/test-merge6.t
--- a/tests/test-merge6.t
+++ b/tests/test-merge6.t
@@ -1,6 +1,6 @@
   $ cat < merge
   > import sys, os
-  > print "merging for", os.path.basename(sys.argv[1])
+  > print("merging for", os.path.basename(sys.argv[1]))
   > EOF
   $ HGMERGE="$PYTHON ../merge"; export HGMERGE
 
diff --git a/tests/test-merge1.t b/tests/test-merge1.t
--- a/tests/test-merge1.t
+++ b/tests/test-merge1.t
@@ -1,4 +1,5 @@
   $ cat < merge
+  > from __future__ import print_function
   > import sys, os
   > 
   > try:
@@ -8,7 +9,7 @@
   > except ImportError:
   > pass
   > 
-  > print "merging for", os.path.basename(sys.argv[1])
+  > print("merging for", os.path.basename(sys.argv[1]))
   > EOF
   $ HGMERGE="$PYTHON ../merge"; export HGMERGE
 
diff --git a/tests/test-merge-symlinks.t b/tests/test-merge-symlinks.t
--- a/tests/test-merge-symlinks.t
+++ b/tests/test-merge-symlinks.t
@@ -1,5 +1,6 @@
   $ cat > echo.py < #!$PYTHON
+  > from __future__ import print_function
   > import os, sys
   > try:
   > import msvcrt
@@ -9,7 +10,7 @@
   > pass
   > 
   > for k in ('HG_FILE', 'HG_MY_ISLINK', 'HG_OTHER_ISLINK', 'HG_BASE_ISLINK'):
-  > print k, os.environ[k]
+  > print(k, os.environ[k])
   > EOF
 
 Create 2 heads containing the same file, once as
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1793,7 +1793,7 @@
   $ cd problematicencoding
 
   $ $PYTHON > setup.sh < print u'''
+  > print(u'''
   > echo a > text
   > hg add text
   > hg --encoding utf-8 commit -u '\u30A2' -m none
@@ -1803,21 +1803,21 @@
   > hg --encoding utf-8 commit -u none -m '\u30A2'
   > echo d > text
   > hg --encoding utf-8 commit -u none -m '\u30C2'
-  > '''.encode('utf-8')
+  > '''.encode('utf-8'))
   > EOF
   $ sh < setup.sh
 
 test in problematic encoding
   $ $PYTHON > test.sh < print u'''
+  > print(u'''
   > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
   > echo 
   > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
   > echo 
   > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
   > echo 
   > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
-  > '''.encode('cp932')
+  > '''.encode('cp932'))
   > EOF
   $ sh < test.sh
   0
diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t
--- a/tests/test-largefiles-cache.t
+++ b/tests/test-largefiles-cache.t
@@ -96,7 +96,7 @@
   > #!$PYTHON
   > 

D294: tests: clean up many print statements to be print functions instead

2017-08-09 Thread durin42 (Augie Fackler)
durin42 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/D294

AFFECTED FILES
  tests/test-commit-interactive-curses.t
  tests/test-commit-multiple.t
  tests/test-contrib-check-code.t
  tests/test-convert-cvs.t
  tests/test-eol.t
  tests/test-extension.t
  tests/test-filebranch.t
  tests/test-glog.t
  tests/test-hardlinks.t
  tests/test-help.t
  tests/test-hook.t
  tests/test-inherit-mode.t
  tests/test-issue4074.t
  tests/test-largefiles-cache.t
  tests/test-log.t
  tests/test-merge-symlinks.t
  tests/test-merge1.t
  tests/test-merge6.t
  tests/test-mq-eol.t
  tests/test-notify-changegroup.t

CHANGE DETAILS

diff --git a/tests/test-notify-changegroup.t b/tests/test-notify-changegroup.t
--- a/tests/test-notify-changegroup.t
+++ b/tests/test-notify-changegroup.t
@@ -39,7 +39,7 @@
 push
 
   $ hg --traceback --cwd b push ../a 2>&1 |
-  > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", 
sys.stdin.read()),'
+  > $PYTHON -c 'from __future__ import print_function ; import sys,re; 
print(re.sub("\n\t", " ", sys.stdin.read()), end="")'
   pushing to ../a
   searching for changes
   adding changesets
@@ -92,7 +92,7 @@
 unbundle with correct source
 
   $ hg --config notify.sources=unbundle --cwd a unbundle ../test.hg 2>&1 |
-  > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", 
sys.stdin.read()),'
+  > $PYTHON -c 'from __future__ import print_function ; import sys,re; 
print(re.sub("\n\t", " ", sys.stdin.read()), end="")'
   adding changesets
   adding manifests
   adding file changes
@@ -167,7 +167,7 @@
 push
 
   $ hg --traceback --cwd b --config notify.fromauthor=True push ../a 2>&1 |
-  > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", 
sys.stdin.read()),'
+  > $PYTHON -c 'from __future__ import print_function ; import sys,re; 
print(re.sub("\n\t", " ", sys.stdin.read()), end="")'
   pushing to ../a
   searching for changes
   adding changesets
diff --git a/tests/test-mq-eol.t b/tests/test-mq-eol.t
--- a/tests/test-mq-eol.t
+++ b/tests/test-mq-eol.t
@@ -33,7 +33,7 @@
   > for line in file(sys.argv[1], 'rb'):
   > line = line.replace('\r', '')
   > line = line.replace('\n', '')
-  > print line
+  > print(line)
   > EOF
 
   $ hg init repo
diff --git a/tests/test-merge6.t b/tests/test-merge6.t
--- a/tests/test-merge6.t
+++ b/tests/test-merge6.t
@@ -1,6 +1,6 @@
   $ cat < merge
   > import sys, os
-  > print "merging for", os.path.basename(sys.argv[1])
+  > print("merging for", os.path.basename(sys.argv[1]))
   > EOF
   $ HGMERGE="$PYTHON ../merge"; export HGMERGE
 
diff --git a/tests/test-merge1.t b/tests/test-merge1.t
--- a/tests/test-merge1.t
+++ b/tests/test-merge1.t
@@ -1,4 +1,5 @@
   $ cat < merge
+  > from __future__ import print_function
   > import sys, os
   > 
   > try:
@@ -8,7 +9,7 @@
   > except ImportError:
   > pass
   > 
-  > print "merging for", os.path.basename(sys.argv[1])
+  > print("merging for", os.path.basename(sys.argv[1]))
   > EOF
   $ HGMERGE="$PYTHON ../merge"; export HGMERGE
 
diff --git a/tests/test-merge-symlinks.t b/tests/test-merge-symlinks.t
--- a/tests/test-merge-symlinks.t
+++ b/tests/test-merge-symlinks.t
@@ -1,5 +1,6 @@
   $ cat > echo.py < #!$PYTHON
+  > from __future__ import print_function
   > import os, sys
   > try:
   > import msvcrt
@@ -9,7 +10,7 @@
   > pass
   > 
   > for k in ('HG_FILE', 'HG_MY_ISLINK', 'HG_OTHER_ISLINK', 'HG_BASE_ISLINK'):
-  > print k, os.environ[k]
+  > print(k, os.environ[k])
   > EOF
 
 Create 2 heads containing the same file, once as
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1793,7 +1793,7 @@
   $ cd problematicencoding
 
   $ $PYTHON > setup.sh < print u'''
+  > print(u'''
   > echo a > text
   > hg add text
   > hg --encoding utf-8 commit -u '\u30A2' -m none
@@ -1803,21 +1803,21 @@
   > hg --encoding utf-8 commit -u none -m '\u30A2'
   > echo d > text
   > hg --encoding utf-8 commit -u none -m '\u30C2'
-  > '''.encode('utf-8')
+  > '''.encode('utf-8'))
   > EOF
   $ sh < setup.sh
 
 test in problematic encoding
   $ $PYTHON > test.sh < print u'''
+  > print(u'''
   > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
   > echo 
   > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
   > echo 
   > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
   > echo 
   > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
-  > '''.encode('cp932')
+  > '''.encode('cp932'))
   > EOF
   $ sh < test.sh
   0
diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t
--- a/tests/test-largefiles-cache.t
+++ b/tests/test-largefiles-cache.t
@@ -96,7 +96,7 @@
   > #!$PYTHON
   > import sys, os
   > path = sys.argv[1]
-  > print '%03o' % (os.lstat(path).st_mode & 0777)
+  > print('%03o' % (os.lstat(path).st_mode & 0777))
   > EOF
   $ chmod +x