You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/04/30 12:08:05 UTC
svn commit: r1741739 - in /subversion/trunk:
contrib/client-side/svnmerge/svnmerge.py tools/dev/mergegraph/save_as_sh.py
Author: stefan2
Date: Sat Apr 30 10:08:05 2016
New Revision: 1741739
URL: http://svn.apache.org/viewvc?rev=1741739&view=rev
Log:
Work towards Python 3 compatibility. Since we already require Python 2.7+,
we can use the new syntax without further limiting our Python 2 support.
* contrib/client-side/svnmerge/svnmerge.py
* tools/dev/mergegraph/save_as_sh.py
(): Replace occurances of Python 2 print statements to files with calls
to the file write function. Don't forget to explicitly add a
newline print would have added one.
Modified:
subversion/trunk/contrib/client-side/svnmerge/svnmerge.py
subversion/trunk/tools/dev/mergegraph/save_as_sh.py
Modified: subversion/trunk/contrib/client-side/svnmerge/svnmerge.py
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/client-side/svnmerge/svnmerge.py?rev=1741739&r1=1741738&r2=1741739&view=diff
==============================================================================
--- subversion/trunk/contrib/client-side/svnmerge/svnmerge.py (original)
+++ subversion/trunk/contrib/client-side/svnmerge/svnmerge.py Sat Apr 30 10:08:05 2016
@@ -1412,9 +1412,9 @@ def action_init(target_dir, target_props
# Write out commit message if desired
if opts["commit-file"]:
f = open(opts["commit-file"], "w")
- print >>f, 'Initialized merge tracking via "%s" with revisions "%s" from ' \
- % (NAME, revs)
- print >>f, '%s' % source_url
+ f.write('Initialized merge tracking via "%s" with revisions "%s" from \n' \
+ % (NAME, revs))
+ f.write('%s\n' % source_url)
f.close()
report('wrote commit message to "%s"' % opts["commit-file"])
@@ -1555,15 +1555,15 @@ def action_merge(branch_dir, branch_prop
if opts["commit-file"]:
f = open(opts["commit-file"], "w")
if record_only:
- print >>f, 'Recorded merge of revisions %s via %s from ' % \
- (revs, NAME)
+ f.write('Recorded merge of revisions %s via %s from \n' % \
+ (revs, NAME))
else:
- print >>f, 'Merged revisions %s via %s from ' % \
- (revs, NAME)
- print >>f, '%s' % opts["source-url"]
+ f.write('Merged revisions %s via %s from \n' % \
+ (revs, NAME))
+ f.write('%s\n' % opts["source-url"])
if opts["commit-verbose"]:
- print >>f
- print >>f, construct_merged_log_message(opts["source-url"], revs),
+ f.write("\n")
+ f.write(construct_merged_log_message(opts["source-url"], revs))
f.close()
report('wrote commit message to "%s"' % opts["commit-file"])
@@ -1592,11 +1592,11 @@ def action_block(branch_dir, branch_prop
# Write out commit message if desired
if opts["commit-file"]:
f = open(opts["commit-file"], "w")
- print >>f, 'Blocked revisions %s via %s' % (revs_to_block, NAME)
+ f.write('Blocked revisions %s via %s\n' % (revs_to_block, NAME))
if opts["commit-verbose"]:
- print >>f
- print >>f, construct_merged_log_message(opts["source-url"],
- revs_to_block),
+ f.write("\n")
+ f.write(construct_merged_log_message(opts["source-url"],
+ revs_to_block))
f.close()
report('wrote commit message to "%s"' % opts["commit-file"])
@@ -1623,11 +1623,11 @@ def action_unblock(branch_dir, branch_pr
# Write out commit message if desired
if opts["commit-file"]:
f = open(opts["commit-file"], "w")
- print >>f, 'Unblocked revisions %s via %s' % (revs_to_unblock, NAME)
+ f.write('Unblocked revisions %s via %s\n' % (revs_to_unblock, NAME))
if opts["commit-verbose"]:
- print >>f
- print >>f, construct_merged_log_message(opts["source-url"],
- revs_to_unblock),
+ f.write("\n")
+ f.write(construct_merged_log_message(opts["source-url"],
+ revs_to_unblock))
f.close()
report('wrote commit message to "%s"' % opts["commit-file"])
@@ -1694,12 +1694,12 @@ def action_rollback(branch_dir, branch_p
if opts["commit-file"]:
f = open(opts["commit-file"], "w")
if record_only:
- print >>f, 'Recorded rollback of revisions %s via %s from ' % \
- (revs , NAME)
+ f.write('Recorded rollback of revisions %s via %s from \n' % \
+ (revs , NAME))
else:
- print >>f, 'Rolled back revisions %s via %s from ' % \
- (revs , NAME)
- print >>f, '%s' % opts["source-url"]
+ f.write('Rolled back revisions %s via %s from \n' % \
+ (revs , NAME))
+ f.write('%s\n' % opts["source-url"])
f.close()
report('wrote commit message to "%s"' % opts["commit-file"])
@@ -1732,8 +1732,8 @@ def action_uninit(branch_dir, branch_pro
# Write out commit message if desired
if opts["commit-file"]:
f = open(opts["commit-file"], "w")
- print >>f, 'Removed merge tracking for "%s" for ' % NAME
- print >>f, '%s' % opts["source-url"]
+ f.write('Removed merge tracking for "%s" for \n' % NAME)
+ f.write('%s\n' % opts["source-url"])
f.close()
report('wrote commit message to "%s"' % opts["commit-file"])
Modified: subversion/trunk/tools/dev/mergegraph/save_as_sh.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/mergegraph/save_as_sh.py?rev=1741739&r1=1741738&r2=1741739&view=diff
==============================================================================
--- subversion/trunk/tools/dev/mergegraph/save_as_sh.py (original)
+++ subversion/trunk/tools/dev/mergegraph/save_as_sh.py Sat Apr 30 10:08:05 2016
@@ -26,13 +26,13 @@
def shebang_line(out):
- print >> out, '#!/bin/sh'
+ out.write('#!/bin/sh\n')
def command(out, cmd, *args):
"""Write the shell command CMD with the arguments ARGS to the file-like
object OUT.
"""
- print >> out, ' '.join((cmd,) + args)
+ out.write(' '.join((cmd,) + args) + "\n")
def svn(out, subcmd, *args):
"""Write an svn command with the given subcommand and arguments. Write
@@ -43,7 +43,7 @@ def svn(out, subcmd, *args):
def comment(out, text):
"""Write the comment TEXT to the file-like object OUT.
"""
- print >> out, '#', text
+ out.write('# %s\n' % text)
def node_branch(node_name):
"""Extract branch name from a node name.