Monday, December 20, 2010

Subversion - merge changes in trunk and brunch from command line

Command line junkies can merge revisions from branch to trunk via svn command if they have a SVN command line client:
  1. Go to the project in the branch and show the log (via repo-browser or IDE).
  2. Look the revision at the beginning of your changes. Subtract 1 from the revision number.
  3. Look the revision at the end of your changes. Add 1 to the revision number.
  4. Go to the trunk working copy and type "svn merge -r <revision from step 2>:<revision from step 3> branchURL".
/svn/trunk/myproject> svn merge -r 30308:30648 svn+ssh://

Conflicts (if they exist) must be resolved manually.

Another tip to file comparision between two projects (brunch vs. trunk).

Goto the the trunk working copy and type
svn -c <change> svn+ssh://

This is a short command of
svn -r <change - 1>:<change> svn+ssh://
<change> is the revision number in the branch to be compared with the head revision in the trunk.

A bunch of changes can be compared with
svn -r <changeVon>:<changeBis> svn+ssh://
where <changeVon> is the start revision and <changeBis> is the end one.

The same operations can be done vice versa if you go to the brunch working copy and compare with trunk (by typing trunk URL).