[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH][SVNMERGE] Refactoring svnmerge.py in anticipation of 'svnmerge rollback'

From: Madan U Sreenivasan <madan_at_collab.net>
Date: 2006-05-10 12:41:47 CEST

Thanks for pointing out danderson.

Heres the corrected patch and log...

[[[
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.
]]]

On Wed, 10 May 2006 15:29:29 +0530, David Anderson
<david.anderson@calixo.net> wrote:

> * Madan U Sreenivasan <madan@collab.net> [2006-05-10 14:22:08]:
>> 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"
>> +
>> + f = open(opts["commit-file"], "w")
>
> Why are you passing a commit_file argument, and then opening
> opts["commit-file"] ? Shouldn't this be:
>
> f = open(commit_file, "w")
>
> ?
>
> - Dave.
>

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"
+
+ f = open(commit_file, "w")
+ print >>f, msg
+ f.close()
+ report('wrote commit message to "%s"' % commit_file)
+
 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.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed May 10 12:11:24 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.