Branch merging

From Regattadata

Once you're sure that the code is ready to be folded into the trunk, you need to merge the branch and the trunk. In order to do this, you need to know what revision the branch started, and what revision the branch is at now. To find this out, run:

svn log https://secure.gavintech.com/svn/branches/rds/development/(branch_name) | less

Then look for the log entry for the start of the branch (something like "Make a new devel branch for bug 34, div layout"). That's the start revision. The top entry (the latest commit to your branch) is the end revision.

Make a new staging branch with the latest trunk code:

svn cp https://secure.gavintech.com/svn/rds/trunk/rds https://secure.gavintech.com/svn/branches/rds/staging/(branch_name)

Remember this revision number, as you'll need it as (staging-rev) later.

Switch to the staging branch:

svn switch https://secure.gavintech.com/svn/branches/rds/staging/(branch_name)

Then, merge the code from the development branch onto the staging branch:

svn merge -r start-rev:end-rev https://secure.gavintech.com/svn/branches/rds/development/(branch_name)

This will take all of the changes made in the branch, bundle them up, and apply them to the staging branch. There may be a couple of conflicts if development happened for a long time, as someone may have modified the trunk at exactly the same line as the branch. Solve these conflicts (look for the files with the C beside them while the merge happens), and run:

svn resolved /path/to/file

to mark the file as no longer conflicted.

At this point you probably want to run some smoketests and make sure that the functionality still works as it's supposed to.

Once that's done, you want to svn commit, with a log message that says something like: "merged revision start-rev to end-rev from branch 34-div-layout to add div layout functionality".

svn commit

Now, you need to resolve migration numbering. SVN move the migrations to new numbers that have not yet been used.

svn mv migrations/xxxx-migration migrations/yyyy-migration

SVN commit if you moved any migrations:

svn commit

Remember this revision number (commit-rev), as you'll need it shortly.

Switch to the trunk now:

svn switch https://secure.gavintech.com/svn/rds/trunk/rds

Merge the staging branch onto the trunk:

svn merge -r (staging-rev):(commit-rev) https://secure.gavintech.com/svn/branches/rds/staging/(branch_name)

Finally, commit it with the same message as used when committing the staging branch: "merged revision start-rev to end-rev from branch 34-div-layout to add div layout functionality".

svn commit