views:

629

answers:

7

I have been tasked with coming up with a strategy for branching, merging and releasing over the next 6 months.

The complication comes from the fact the we will be running multiple projects all with different code changes and different release dates but approximately the same development start dates.

At present we are using VSS for code management, but are aware that it will probably cause some issues and will be migrating to TFS before new development starts.

What strategies should I be employing and what things should I be considering before setting a plan down?

Sorry if this is vague, feel free to ask questions and I will update with more information if required.

+1  A: 

The subversion book describes some common branching patterns. Maybe you can also apply these to TFS.

M4N
+3  A: 

Absolutely positively make sure you get rid of VSS. Otherwise you will get to enjoy six months of pain frustration and loss of hair.

Byron Whitlock
we are already agreed on this
benPearce
+6  A: 

This documentation helped a lot when we were moving from VSS to TFS: Microsoft Team Foundation Server Branching Guidance.

ryan.rousseau
+2  A: 

My first recommendation would be to read Eric Sink's Source Control HOWTO - specifically the branches and branch merge chapters.

We have 3 containers - DEV, MAIN, and RELEASE for our work. MAIN contains all our "ready-to-release" code and we tend to think of it as "basically stable." DEV/Iteration (or DEV/Feature, or DEV/RiskyFeatureThatMightBreakSomeoneElse) are branches from MAIN and are merged up when the Iteration/Feature is ready to promote up past the DEV environment. We also have TFS builds set up from the DEV/Iteration branch and the MAIN branch.

Our RELEASE container contains numbered releases (similar to the "tags" container used in many Subversion repositories). We simply take a branch from MAIN each time - I like to say we're "cutting" a RELEASE branch to signify this shouldn't have a lot of activity going on once the merge is finished.

As for VSS->TFS - Microsoft supports an upgrade path which should keep your version history, but if you don't need it the history, I would just get the latest version from VSS, check it into TFS and archive the VSS repository.

One final tip - get your team members familiar with source control. They must understand branching and merging or you will be stuck doing a lot of cleanup work :).

Good luck!

Nicolas Webb
+1  A: 

The simplest and most usual way I've seen branching work is off two premises. Trunk and Release. I think this is known as the "Unstable trunk, stable branch" philosophy.

Trunk is your main source. This contains the "latest and the greatest" code and is forward looking. It generally isn't always stable.

Release is a one-to-many association with trunk. There is one trunk but many releases that derive from the trunk. Releases generally start with a branch of the trunk once a particular functionality milestone has been hit so the "only" things left to go in for a particular deployment should just be bug fixes. You then branch the trunk, give it a label (e.g. 1.6 Release is our current latest Release), build and send the release to QA. We also push the version number (usually the minor number) of the trunk up at this point to ensure we don't have two releases with the same number.

Then you begin the testing cycle on your release branch. When sufficient testing has been perfomed you apply bug fixes to the release branch, merge these back to the trunk (to ensure bug fixes are carried forward!) and then re-release a build of the branch. This cycle with QA continues until you are both happy and the release is finally given to the customer(s). Any bug reports from the customer(s) that are accurate (i.e. they are a bug!) start another QA cycle with the branch in question.

As you create future releases it is a good idea to also try to move older customers onto newer branches to reduce the potential number of branches you might have to back-patch a bug fix into.

Using this technique you can deploy solutions using your technology to a variety of customers that require different levels of service (starting with least first), you can isolate your existing deployments from "dangerous" new code in the trunk and the worst merge scenario is one branch.

Quibblesome
+8  A: 

This is the single best source control pattern that I have come across. It emphasizes the importance of leaving the trunk free of any junk (no junk in the trunk). Development should be done in development branches, and regular merges (after the code has been tested) should be made back into the trunk (Pic 1), but the model also allows for source to be patched while still under development (Pic 2). I definitely recommend reading the post in its entirety, to completely understand.

Big Picture

     Pic 1

Patching

     Pic 2

Edit: The pictures are definitely confusing without words. I could explain, but I would basically be copying the original author. Having said that, I probably should have selected a better picture to describe the merge process, so hopefully this helps. I'd still recommend reading the post, however:alt text

senfo
I'm totally adopting "no junk in the trunk" for describing our MAIN branch. Awesome.
Nicolas Webb
I'm gonna read up on this but I don't get it off just the image, especially if you say: "no junk in the trunk". Who is testing the trunk? As far as I can tell this pattern suggests the opposite as no-one is primarily using the trunk for dev or test....
Quibblesome
@Quibblesome - pattern says that it has to be fit for release before its merged into the trunk and strongly suggests that, after the merge, the Branch and the Trunk will be identical..
Murph
A: 

Take a look at the this link regarding "branch per task"

alt text

pablo