Resolving Subversion merge conflicts

| No Comments | No TrackBacks
Merging an entire branch back into the trunk can be a pain.  I've found that if you only want to keep the changes made to the branch then the following steps should help. Using svnmerge.py makes the whole process a bit easier by automatically tracking revision number ranges.  Information on svnmerge.py can be found here:  http://www.orcaware.com/svn/wiki/Svnmerge.py

Here are the steps:

  1. Begin by following the steps for merging the branch here (assumes you are using svnmerge.py):
    http://www.orcaware.com/svn/wiki/Svnmerge.py#Merging_development_branches_back_to_trunk

  2. Handle conflicts. If the branch is up-to-date, simply copy the latest revision file to the conflicted file. 

    Example: Let's say the latest revision is 100 and after merging a branch to the trunk, conflicts are present. The following shell one-liner will automatically resolve the conflicts, but only if the branch version is authoritative. If the trunk version has features not yet added to the branch version, you must manually resolve the conflict. 

    prompt:~# for a in *.r100; do b=`perl -e 'print split /\.merge-right.r100/, shift;' $a`; echo "copying $a $b"; cp $a $b; svn resolved $b; echo; done

    If this makes you nervous you can always consult the manual: http://svnbook.red-bean.com/en/1.5/svn.tour.cycle.html#svn.tour.cycle.resolve

  3. Commit the merge: svn ci -F svnmerge-commit-message.txt
Your branch should now be successfully merged into the trunk!

No TrackBacks

TrackBack URL: http://www.coderfoo.com/cgi-bin/mt/mt-tb.cgi/5

Leave a comment

Pages

About this Entry

This page contains a single entry by Andy published on July 14, 2009 4:25 PM.

Dynamically build SQL statements for Perl DBI was the previous entry in this blog.

YUI TreeView: Drag and Drop nodes is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.261