Better Merging with Subversion [www.orcaware.com]
In an earlier blog post about branching and merging with subversion, I detailed how I do merging with subversion alone.
It's great to understand the basics but as Mark Aufflick commented on that same article, you're crazy if you don't use "svnmerge.py".
So, what is svnmerge.py? Why do you need it?
The problem stems from the fact that Subversion, older than version 1.5, do not keep track of your merges.
As a result, the developer needs to keep track of merges manually. This means that a developer will have to take note of which revisions were merged to the trunk or to a branch. If the developer is not organized and diligent with tracking his/her merges, it is perfectly possible to "remerge" revisions that have already been merged before, resulting into lots of conflicts and hours of trying to sort them out.
If you're working on a project with just one trunk, one branch, and just one developer, you could probably get by without svnmerge.py but the reality is that most projects have one trunk, multiple branches, and multiple geographically dispersed developers.
Here's the step-by-step guide on merging changes from a branch back to the trunk but this time we'll use svnmerge.py. Note that you will need subversion 1.1 or higher and svnmerge.py r22788 or higher.
http://code.solutiongrove.com/svn/viewvc.cgi/monitorex/trunk/ http://code.solutiongrove.com/svn/viewvc.cgi/monitorex/branches/ http://code.solutiongrove.com/svn/viewvc.cgi/monitorex/tags/
mkdir workspace svn checkout svn+ssh://ham@code.solutiongrove.com/home/code/svnrepo/solutiongrove/monitorex/trunk trunk cd trunk svnmerge.py init svn ci -F svnmerge-commit-message.txt rm svnmerge-commit-message.txt
cd workspace svn cp svn+ssh://ham@code.solutiongrove.com/home/code/svnrepo/solutiongrove/monitorex/trunk \ svn+ssh://ham@code.solutiongrove.com/home/code/svnrepo/solutiongrove/monitorex/branches/mytestbranch svn checkout svn+ssh://ham@code.solutiongrove.com/home/code/svnrepo/solutiongrove/monitorex/branches/mytestbranch/ mytestbranch cd mytestbranch svnmerge.py init svn ci -F svnmerge-commit-message.txt rm svnmerge-commit-message.txt svn checkout svn+ssh://ham@code.solutiongrove.com/home/code/svnrepo/solutiongrove/monitorex/trunk trunk cd ../trunk svnmerge.py init svn+ssh://ham@code.solutiongrove.com/home/code/svnrepo/solutiongrove/monitorex/branches/mytestbranch svn ci -F svnmerge-commit-message.txt rm svnmerge-commit-message.txt
cd workspace/trunk svnmerge.py avail --bidirectional --log
cd workspace/trunk svnmerge.py merge --bidirectional -r2345 svn ci -F svnmerge-commit-message.txt rm svnmerge-commit-message.txt
That basically sums it up. In addition to merging from branch to trunk, a developer can also merge from trunk to any branch. For more information, there is a detailed wiki page about svnmerge.py in the subversion wiki.
Happy merging!!!
You may request notification for Solution Grove Blog.