Saturday, September 8, 2007

Subversion Merge Tracking – The Basics

Subversion 1.5 will support Merge Tracking. This blog post provides a high level overview of what Merge Tracking is, why it is important and what it means to your organization.

What’s branching and merging?

Development teams often work on several parallel lines of development, called ‘branches.’ A branch starts with making copies of all the files of your development project (or a directory) and maintaining these copies separately as you go forward. Files start as identical copies but over time they will differ from each other as developers make changes on the different branches.

Why branch? You might create a branch in Subversion for the maintenance of a released product while simultaneously working on the next release. Why? The next release will have new features but on the maintenance branch you only accept bug fixes. Another use case is the development of a complex new feature that you know will destabilize your development builds. By doing that development on a separate branch, you isolate the other developers from the disruptive work that would break nightly builds for everybody. Subversion’s own Merge Tracking feature was developed on a branch for about a year.

Subversion has always supported branching and unlike many other systems it does not actually copy the files, which would rapidly grow the size of the repository. Instead, Subversion creates a quick reference to the existing directory and from there on just tracks the changes to the files on the branch and trunk. The result is that creating a branch is very quick and the repository hardly grows in size.

At times, code needs to be merged. For instance, a developer fixes a bug in the maintenance branch. You will want to merge that fix into the main development line, otherwise your next release will still have the bug. Another example is the development of a new feature on a branch. As said, Subversion’s own Merge Tracking feature was developed on a branch. In February ’07 the feature was stable enough to be merged into trunk.

0 Comments: