Reputation: 12905
We need to merge our branch back to trunk.
We want to have all commits messages from branch also im trunk.
So we probably have to merge every single revision separately like:
Original commit message: "Fixed that bad bug"
Commit message after merge "Merged from Branch: Fixed that bad bug"
Does anybody know the way to automate it?
Thank you
Upvotes: 2
Views: 84
Reputation: 5765
This isn't directly what you want but I'll show you how to get the info you want without any of the hassle of scripting it.
Subversion since 1.5.0 has had the --use-merge-history
or -g
option to log. If you do a merge then when you do -g it'll show the log messages from the merged revisions in the log.
E.G. you'll have output like this:
$ svn log -g ------------------------------------------------------------------------ r5 | breser | 2014-01-23 10:00:57 -0800 (Thu, 23 Jan 2014) | 2 lines Merged badbug branch ------------------------------------------------------------------------ r4 | breser | 2014-01-23 10:00:41 -0800 (Thu, 23 Jan 2014) | 2 lines Merged via: r5 Fix that bad bug ------------------------------------------------------------------------ r3 | breser | 2014-01-23 10:00:10 -0800 (Thu, 23 Jan 2014) | 2 lines Merged via: r5 Create badbug branch ------------------------------------------------------------------------ r2 | breser | 2014-01-23 09:58:07 -0800 (Thu, 23 Jan 2014) | 2 lines Add foo ------------------------------------------------------------------------ r1 | breser | 2014-01-23 09:57:51 -0800 (Thu, 23 Jan 2014) | 2 lines Create trunk and branches ------------------------------------------------------------------------
Note how r3 and r4 have the Merged via: line. Because those revisions were merged back in by the r5 and are being shown by way of the merge tracking.
If you don't like that you're going to have to script something up that determines what revisions to merge and then does cherry pick merges for each one duplicating the log message. You can use svn mergeinfo --show-revs eligible ^/branches/source ^/branches/target
(where the source is the branch you want to merge from and target is the branch you want to merge to) to get a list of the eligible revisions to merge. Then it's just a matter of using svn propget svn:log --revprop -r $REV
to get the commit message, modifying the message to add your header saying it's a merge, running svn merge -c $REV ^/branches/source ^/branches/target -m $MESSAGE
.
But in my opinion that's a lot of work to handle something that the client can just do for you with -g
.
Upvotes: 2