diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t --- a/tests/test-commit-interactive-curses.t +++ b/tests/test-commit-interactive-curses.t @@ -345,7 +345,7 @@ > $PYTHON < from mercurial import hg, ui;\ > repo = hg.repository(ui.ui.load(), ".");\ - > print repo.ui.interface("chunkselector") + > print(repo.ui.interface("chunkselector")) > EOF > } $ chunkselectorinterface diff --git a/tests/test-commit-multiple.t b/tests/test-commit-multiple.t --- a/tests/test-commit-multiple.t +++ b/tests/test-commit-multiple.t @@ -90,7 +90,7 @@ > f.close() > > def printfiles(repo, rev): - > print "revision %s files: %s" % (rev, repo[rev].files()) + > print("revision %s files: %s" % (rev, repo[rev].files())) > > repo = hg.repository(ui.ui.load(), '.') > assert len(repo) == 6, \ @@ -99,14 +99,14 @@ > replacebyte("bugfix", "u") > sleep(2) > try: - > print "PRE: len(repo): %d" % len(repo) + > print("PRE: len(repo): %d" % len(repo)) > wlock = repo.wlock() > lock = repo.lock() > replacebyte("file1", "x") > repo.commit(text="x", user="test", date=(0, 0)) > replacebyte("file1", "y") > repo.commit(text="y", user="test", date=(0, 0)) - > print "POST: len(repo): %d" % len(repo) + > print("POST: len(repo): %d" % len(repo)) > finally: > lock.release() > wlock.release() diff --git a/tests/test-contrib-check-code.t b/tests/test-contrib-check-code.t --- a/tests/test-contrib-check-code.t +++ b/tests/test-contrib-check-code.t @@ -213,32 +213,32 @@ [1] $ cat > ./map-inside-gettext.py < print _("map inside gettext %s" % v) + > print(_("map inside gettext %s" % v)) > - > print _("concatenating " " by " " space %s" % v) - > print _("concatenating " + " by " + " '+' %s" % v) + > print(_("concatenating " " by " " space %s" % v)) + > print(_("concatenating " + " by " + " '+' %s" % v)) > - > print _("mapping operation in different line %s" - > % v) + > print(_("mapping operation in different line %s" + > % v)) > - > print _( - > "leading spaces inside of '(' %s" % v) + > print(_( + > "leading spaces inside of '(' %s" % v)) > EOF $ "$check_code" ./map-inside-gettext.py ./map-inside-gettext.py:1: - > print _("map inside gettext %s" % v) + > print(_("map inside gettext %s" % v)) don't use % inside _() ./map-inside-gettext.py:3: - > print _("concatenating " " by " " space %s" % v) + > print(_("concatenating " " by " " space %s" % v)) don't use % inside _() ./map-inside-gettext.py:4: - > print _("concatenating " + " by " + " '+' %s" % v) + > print(_("concatenating " + " by " + " '+' %s" % v)) don't use % inside _() ./map-inside-gettext.py:6: - > print _("mapping operation in different line %s" + > print(_("mapping operation in different line %s" don't use % inside _() ./map-inside-gettext.py:9: - > print _( + > print(_( don't use % inside _() [1] diff --git a/tests/test-convert-cvs.t b/tests/test-convert-cvs.t --- a/tests/test-convert-cvs.t +++ b/tests/test-convert-cvs.t @@ -12,10 +12,10 @@ $ echo "convert = " >> $HGRCPATH $ cat > cvshooks.py < def cvslog(ui,repo,hooktype,log): - > print "%s hook: %d entries"%(hooktype,len(log)) + > print("%s hook: %d entries"%(hooktype,len(log))) > > def cvschangesets(ui,repo,hooktype,changesets): - > print "%s hook: %d changesets"%(hooktype,len(changesets)) + > print("%s hook: %d changesets"%(hooktype,len(changesets))) > EOF $ hookpath=`pwd` $ cat <> $HGRCPATH diff --git a/tests/test-eol.t b/tests/test-eol.t --- a/tests/test-eol.t +++ b/tests/test-eol.t @@ -16,7 +16,7 @@ > except ImportError: > pass > (old, new) = sys.argv[1] == 'LF' and ('\n', '\r\n') or ('\r\n', '\n') - > print "%% switching encoding from %r to %r" % (old, new) + > print("%% switching encoding from %r to %r" % (old, new)) > for path in sys.argv[2:]: > data = file(path, 'rb').read() > data = data.replace(old, new) diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -75,13 +75,13 @@ $ cat > foo.py < import os > name = os.path.basename(__file__).rsplit('.', 1)[0] - > print "1) %s imported" % name + > print("1) %s imported" % name) > def uisetup(ui): - > print "2) %s uisetup" % name + > print("2) %s uisetup" % name) > def extsetup(): - > print "3) %s extsetup" % name + > print("3) %s extsetup" % name) > def reposetup(ui, repo): - > print "4) %s reposetup" % name + > print("4) %s reposetup" % name) > > # custom predicate to check registration of functions at loading > from mercurial import ( @@ -172,7 +172,7 @@ $ cat > loadabs.py < import mod.ambigabs as ambigabs > def extsetup(): - > print 'ambigabs.s=%s' % ambigabs.s + > print('ambigabs.s=%s' % ambigabs.s) > EOF $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) ambigabs.s=libroot/ambig.py @@ -186,7 +186,7 @@ $ cat > loadrel.py < import mod.ambigrel as ambigrel > def extsetup(): - > print 'ambigrel.s=%s' % ambigrel.s + > print('ambigrel.s=%s' % ambigrel.s) > EOF $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) ambigrel.s=libroot/mod/ambig.py diff --git a/tests/test-filebranch.t b/tests/test-filebranch.t --- a/tests/test-filebranch.t +++ b/tests/test-filebranch.t @@ -2,8 +2,9 @@ when we do a merge. $ cat < merge + > from __future__ import print_function > 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-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -1633,7 +1633,7 @@ Test glob expansion of pats $ expandglobs=`$PYTHON -c "import mercurial.util; \ - > print mercurial.util.expandglobs and 'true' or 'false'"` + > print(mercurial.util.expandglobs and 'true' or 'false')"` $ if [ $expandglobs = "true" ]; then > testlog 'a*'; > else diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t --- a/tests/test-hardlinks.t +++ b/tests/test-hardlinks.t @@ -1,11 +1,12 @@ #require hardlink $ cat > nlinks.py < from __future__ import print_function > import sys > from mercurial import util > for f in sorted(sys.stdin.readlines()): > f = f[:-1] - > print util.nlinks(f), f + > print(util.nlinks(f), f) > EOF $ nlinksdir() diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1709,7 +1709,7 @@ $ $PYTHON < upper = "\x8bL\x98^" - > print "hg --encoding cp932 help -e ambiguous.%s" % upper + > print("hg --encoding cp932 help -e ambiguous.%s" % upper) > EOF \x8bL\x98^ (esc) ---- @@ -1719,7 +1719,7 @@ $ $PYTHON < lower = "\x8bl\x98^" - > print "hg --encoding cp932 help -e ambiguous.%s" % lower + > print("hg --encoding cp932 help -e ambiguous.%s" % lower) > EOF \x8bl\x98^ (esc) ---- diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -409,6 +409,7 @@ $ cd "$TESTTMP/b" $ cat > hooktests.py < from __future__ import print_function > from mercurial import error > > uncallable = 0 @@ -418,9 +419,9 @@ > args.pop('repo', None) > a = list(args.items()) > a.sort() - > print 'hook args:' + > print('hook args:') > for k, v in a: - > print ' ', k, v + > print(' ', k, v) > > def passhook(**args): > printargs(args) @@ -445,7 +446,7 @@ > ui.note('verbose output from hook\n') > > def printtags(ui, repo, **args): - > print sorted(repo.tags()) + > print(sorted(repo.tags())) > > class container: > unreachable = 1 @@ -630,7 +631,7 @@ $ cat > hookext.py < def autohook(**args): - > print "Automatically installed hook" + > print("Automatically installed hook") > > def reposetup(ui, repo): > repo.ui.setconfig("hooks", "commit.auto", autohook) @@ -667,7 +668,7 @@ $ cd hooks $ cat > testhooks.py < def testhook(**args): - > print 'hook works' + > print('hook works') > EOF $ echo '[hooks]' > ../repo/.hg/hgrc $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc diff --git a/tests/test-inherit-mode.t b/tests/test-inherit-mode.t --- a/tests/test-inherit-mode.t +++ b/tests/test-inherit-mode.t @@ -25,13 +25,13 @@ > allnames.sort() > for name in allnames: > suffix = name in isdir and '/' or '' - > print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix) + > print('%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)) > EOF $ cat >mode.py < import sys > import os - > print '%05o' % os.lstat(sys.argv[1]).st_mode + > print('%05o' % os.lstat(sys.argv[1]).st_mode) > EOF $ umask 077 diff --git a/tests/test-issue4074.t b/tests/test-issue4074.t --- a/tests/test-issue4074.t +++ b/tests/test-issue4074.t @@ -8,7 +8,7 @@ > print > if random.randint(0, 100) >= 50: > x += 1 - > print hex(x) + > print(hex(x)) > EOF $ hg init a 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 ls-l.py 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,13 +1803,13 @@ > 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' @@ -1817,7 +1817,7 @@ > 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-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-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-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-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-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