6 progname
= os
.path
.basename(sys
.argv
[0])
9 print "Usage: %s SOURCEURL WCPATH [r]REVNUM[,] [...]" % progname
10 print "Try '%s --help' for more information" % progname
13 val
= """This script is meant to ease the pain of merging and
14 reviewing revision(s) on a release branch (although it can be used to
15 merge and review revisions from any line of development to another).
17 To allow cutting and pasting from the STATUS file, revision numbers
18 can be space or comma-separated, and may also include the prefix
21 Lastly, a file (named 'rev1-rev2-rev3.log') is created for you.
22 This file contains each merge command that was run, the log of the
23 revision that was merged, and the diff from the previous revision.
27 %s http://svn.collab.net/repos/svn/trunk svn-1.2.x-branch \
28 r14041, r14149, r14186, r14194, r14238, r14273
30 %s http://svn.collab.net/repos/svn/trunk svn-1.2.x-branch \
31 14041 14149 14186 14194 14238 14273""" % (progname
, progname
)
35 if len(sys
.argv
) > 1 and sys
.argv
[1] == '--help':
46 # Tolerate comma separated lists of revs (e.g. "r234, r245, r251")
48 for rev
in sys
.argv
[3:]:
59 print "Encountered non integer revision '%s'" % orig_rev
64 # Make an easily reviewable logfile
65 logfile
= "-".join(map(lambda x
: str(x
), revs
)) + ".log"
66 log
= open(logfile
, 'w')
69 merge_cmd
= ("svn merge -r%i:%i %s %s" % (rev
- 1, rev
, src_url
, wc_path
))
70 log_cmd
= 'svn log -v -r%i %s' % (rev
, src_url
)
71 diff_cmd
= 'svn diff -r%i:%i %s' % (rev
-1, rev
, src_url
)
77 log
.write("=" * 72 + '\n')
78 log
.write(merge_cmd
+ '\n')
81 fh
= os
.popen(log_cmd
)
90 fh
= os
.popen(diff_cmd
)
98 log
.write("=" * 72 + '\n' * 10)
102 print "\nYour logfile is '%s'" % logfile