scons
SCons Branching and Merging

This page covers how we handle branching and merging in the SCons development tree. We'll use svnmerge to keep track of what changes haven't been merged in each direction. Some of the concepts and steps below have been swiped from a pretty decent svnmerge howto created by Ken Kinder, with liberal help from our Gary Oberbrunner.

Branches

These are the SCons development branches and their intended uses.

How to create a branch off the trunk and initialize it for bi-directional merging

This should take place between any branch and its parent to set up to svnmerge to handle the tracking as we go forward.

$ export SVN=http://scons.tigris.org/svn/scons
$ cd my_working_directory/trunk
$ svn cp $SVN/trunk $SVN/branches/new_branch
$ svn commit
$ cd ..
$ svn co $SVN/branches/new_branch
$ cd new_branch
$ svnmerge init -f commit.txt $SVN/trunk
$ cd ../../trunk
$ svnmerge init -f commit.txt $SVN/branches/new_branch
$ svn commit -F commit.txt && rm commit.txt
$ cd ../branches/new_branch
$ svn commit -F commit.txt && rm commit.txt

You can actually do both the svnmerge init and svn commit on one branch (in one directory) and then do both on the other branch, but doing it this way makes both of them end up with the same revision number in the svnmerge property, which is nice and symmetric.

How to merge changes from the trunk to a development branch

This brings a branch in sync with the latest changes that have made it into the trunk for release (usually by being promoted from other branches, we typically don't do work directly on the trunk).

$ export SVN=http://scons.tigris.org/svn/scons
$ cd my_working_directory/new_branch
$ svn up
$ svnmerge avail -b -S $SVN/trunk -l
$ svnmerge merge -b -S $SVN/trunk -f commit.txt
$ svn resolved .
$ svn diff
$ python runtest.py -a
$ svn commit -F commit.txt && rm commit.txt

The svn resolved . is there because there may be a conflict on the svnmerge-integratedproperty that's attached to the directory to track what changes have or have not already been merged from the trunk.

How to merge changes from a development branch to the trunk

This promotes the branch changes into the trunk. Note that you should really first make sure that your branch has already merged any changes from the trunk (see previous section) before doing this, or else you're likely to overwrite any work that's already been submitted up.

$ export SVN=http://scons.tigris.org/svn/scons
$ cd my_working_directory/trunk
$ svn up
$ svnmerge avail -b -S $SVN/branches/new_branch -l
$ svnmerge merge -b -S $SVN/branches/new_branch -f commit.txt
$ svn resolved .
$ svn diff
$ python runtest.py -a
$ svn commit -F commit.txt && rm commit.txt

The svn resolved . is there because there may be a conflict on the svnmerge-integratedproperty that's attached to the directory to track what changes have or have not already been merged from the development branch.