On Wed, 10 May 2006, Madan S. wrote:
...
> [[[
> Internal refactoring of svnmerge.py in preparation for addition of
> a 'rollback' command. No functional change.
>
> * contrib/client-side/svnmerge.py
> (write_commit_log): New function to write the commit log file.
> (action_merge): Modified to use the write_commit_log() function.
> ]]]
...
> Index: contrib/client-side/svnmerge.py
> ===================================================================
> --- contrib/client-side/svnmerge.py (revision 19600)
> +++ contrib/client-side/svnmerge.py (working copy)
> @@ -955,6 +955,14 @@
> else:
> assert False, "unhandled display style: %s" % display_style
>
> +def write_commit_log(commit_file, msg):
> + "Write the commit message into the commit_file provided"
How about:
"Write the change log message to the specified file."
> + f = open(commit_file, "w")
> + print >>f, msg
> + f.close()
> + report('wrote commit message to "%s"' % commit_file)
> +
There's numerous other places this code could be used, including
action_init(), action_block(), and action_unblock(). Additionally,
this route should either be expanded to include the entirety of the
common 'if opts["commit-file"]' block, or a second function should be
introduced for use in conjunction with this one.
> def action_init(branch_dir, branch_props):
> """Initialize a branch for merges."""
> # Check branch directory is ready for being modified
> @@ -1108,20 +1116,19 @@
>
> # Write out commit message if desired
> if opts["commit-file"]:
> - f = open(opts["commit-file"], "w")
> + commit_msg = ''
> if record_only:
> - print >>f, 'Recorded merge of revisions %s via %s from ' % \
> - (revs | phantom_revs, NAME)
> + commit_msg = 'Recorded merge of revisions %s via %s from ' % \
> + (revs | phantom_revs, NAME)
> else:
> - print >>f, 'Merged revisions %s via %s from ' % \
> - (revs | phantom_revs, NAME)
> - print >>f, '%s' % opts["head-url"]
> + commit_msg = 'Merged revisions %s via %s from ' % \
> + (revs | phantom_revs, NAME)
> + commit_msg += '%s' % opts["head-url"]
> if opts["commit-verbose"]:
> - print >>f
> - print >>f, construct_merged_log_message(opts["head-url"], revs),
> + commit_msg += '\n'
> + commit_msg += construct_merged_log_message(opts["head-url"], revs)
>
> - f.close()
> - report('wrote commit message to "%s"' % opts["commit-file"])
> + write_commit_log(opts["commit-file"], commit_msg)
>
> # Update the set of merged revisions.
> merged_revs = merged_revs | revs | reflected_revs | phantom_revs
> Internal refactoring of svnmerge.py in preparation for addition of
> a 'rollback' command. No functional change.
>
> * contrib/client-side/svnmerge.py
> (write_commit_log): New function to write the commit log file.
> (action_merge): Modified to use the write_commit_log() function.
- application/pgp-signature attachment: stored
Received on Wed May 10 19:53:44 2006