Managing branches in SVN

Posted by admin on September 01, 2007

  • Requirements and Dependencies

    1. svnmerge.py - a python script that helps you keep your branches in synch with the trunk. The script and full documentation are available at http://www.orcaware.com/svn/wiki/Svnmerge.py
    2. define a bash variable of the svn path ($TIS_SVN_URL in this case)
  • Creating the branch

    1. stop your development server
    2. commit any outstanding changes to the trunk
    3. copy the trunk to a branch
      svn copy $TIS_SVN_URL/trunk $TIS_SVN_URL/branches/branch-name
    4. switch over to that branch
      svn switch $TIS_SVN_URL/branches/branch-name
    5. initialize the branch
      svnmerge.py init
    6. commit:
      svn commit -F svnmerge-commit-message.txt
  • Working with the branch

    1. stop your development server
    2. occasionally perform svnmerge.py merge to keep in sync with the trunk
  • Merging branch back into the trunk

    1. stop your development server
    2. with a clean branch switch over to the trunk:
      svn switch $TIS_SVN_URL/trunk
    3. check properties on trunk for any merge stuff:
      svn proplist -v .
    4. Initialize the merge tracking support on the trunk, related to the given branch, using:
      svnmerge.py init $TIS_SVN_URL/branches/alpha02-dashboard
    5. commit:
      svn commit -F svnmerge-commit-message.txt
    6. update
    7. merge:
      svnmerge.py merge --bidirectional -S $TIS_SVN_URL/branches/alpha02-dashboard > merge_log.txt
    8. check merge log for any conflicts
    9. resolve any conflicts
    10. rake test
    11. commit:
      svn commit -F svnmerge-commit-message.txt
    12. svnmerge.py uninit -S $TIS_SVN_URL/branches/alpha02-dashboard
    13. commit:
      svn commit -F svnmerge-commit-message.txt
    14. svn rm -m ‘removing branch’ $TIS_SVN_URL/branches/alpha02-dashboard