Monday, January 26, 2009

Merging in Subversion

Merging in subversion doesn't work like you'd think it'd work. You don't say "take this branch and apply all the changes to trunk". No... you say "calculate the differences between this branch and and older revision then apply these changes to trunk". That's very different. Because of this you need to note the revision at which you're branch was made and use this when merging. Here's a quick example:

Make a branch:
svn copy trunk ./branches/nw3
NOTE THE REVISION NUMBER (basenum) AND LEAVE A USEFUL LOG COMMENT. OK, now make edits commit them etc on the branch. At some point you want to merge the changes in to trunk (run this while in the trunk directory):
svn merge -r basenum:currentrev https://swiftng.svn.sourceforge.net/svnroot/swiftng/trunk
Where basenum is the revision number at which the branch was made and currentrev is the current revision.

2 comments:

Anonymous said...

You get what you pay for. We tried the CVS replacement thing for a while, what a mistake. We went commercial and it paid for itself in less than 6 months compared to the effort to get SVN to do half of what we really needed. If I had to do it all over again, I'd do it right the first time. Changing is a pain!

new said...

meh, I don't want to use a proprietary revision control system. To be honest moving to git is probably the way to go. The nice thing about Subversion is that it's supported in a number of tools across a number of platforms.