views:

54

answers:

3

I was recently reading the TFS Branching Guide and it suggests a branch for every release. For a web site, there is only one "version" released at a time. In that case is it appropriate to have a single "Production" branch? Then, during the process of preparing for a release, you merge changes from the Main branch into Production. (As opposed to the suggestion to branch each release.) If you need to do a hotfix, do it in the Production branch, then reverse integrate into Main. Doing it this way allows you to keep configuration files for Production intact in the Production branch.

p.s. I should mention that we are using a Code Promotion model.

p.p.s. Apparently what I'm talking about exists: it's called a "staging stream" in Practical Perforce

A: 

What is your question? This is currently how we use TFS (which btw is ace)

Chris
"is it appropriate to have a single \"Production\" branch?"
steve_d
+1  A: 

I don't know if it's "appropriate" but I do something similar with Subversion...

Instead of branches/tags/trunk, I have development/test/production. New features/fixes are created in development. Once completed, they are merged to test for testing and client review (by going to the test website). Once passed QA the changes are merged to production. Hook scripts automatically update corresponding development, test, and production websites on checkin, and each "branch" has its own unique web.config file pointing to the appropriate development/test/production database.

pjabbott
+1  A: 

Usually, Production is for reflecting what is in production, that is:

  • what has been pushed in the live site
  • plus whatever hotfixes have been made directly in the live site

That is why, in this configuration, one Production branch is enough.

You will then need, following that logic:

  • release branches where you consolidate your developments and test them before merging the current release to the Production branch. They can serve as source for a staging environment, since, as mentioned in the document you reference in your question (Practical Perfoce):

    it allows you do make extremely frequent releases without having to branch a new codeline for each release. (They’re commonly used to support web development)
    A staging stream is essentially a reusable release codeline. Each staging stream is used for a particular stage of release stabilization.

  • development branches for daily devs (all of which cannot always be part of the next release), and for integrating back the hotfixes made in Prod (merge Prod to Dev).

VonC
Having read that, do you think we need multiple "release"/integration branches? Right now we just have one.
steve_d
@steve_d: if you have a "sequential" enough development lifecycle, you can reuse the same release branch, but I prefer having one per release for clarity. And branching is cheap anyway, plus the merge effort will stay the same.
VonC
branching is cheap - it's merging where the cost comes in.
steve_d
@steve_d: Hence the importance of the "merge effort will stay the same" part of my comment: merging from one unique release branch or from a release branch named after a release won't change.
VonC
The effort to merge from the branches doesn't increase, but the effort to merge to the release branches is at least linear to the number of branches. (merge the changes for release1 from the trunk/main to release2 and release3 and...)
steve_d
@steve_d: that would suppose you actually are maintaining R1 even though R2 is in prod and you are working on R3: that simply won't happen. If you had only one Release branch, you wouldn't have any "R1 changes" because they would be on top of R2 and R3 (being consolidated on the same branch R). The only way to update R1 (which, again, doesn't make a lot of sense if that Release in no longer live) would be to branch from a former revision anyway. And then merge back to trunk: same kind of workflow/effort.
VonC
I think I see what you're saying. I guess I was wondering if it would be worth having, say, a "bigprojects" integration branch off of which projectA, projectB, etc would branch. bigprojects would be branched off the "main" trunk branch. also off main would be "maintenance" which might be used ongoing, or might have subbranches "maint_mar_10_2010" "maint_mar_17_2010" etc - or those could be branched right off the main branch as well.
steve_d
I used to work somewhere that had weekly releases, and made a branch every time. It's probably a case of "matching your process to the tools" but with TFS, branching took too long to do every single week. Also if work wasn't finished in time for its scheduled release it was a huge headache. (Something that would be trivial in a DVCS, optimized for branching and merging)
steve_d
BTW I gave you the "answer" credit just because you kept responding. Well that and you wrote the most thought out, informative answer (granted, there's probably a relation to the increasing information in my original question).anyways thanks.
steve_d
@steve_d: thank you for the "credit" (although if you do find a better answer, you still can change your official answer selection). Regarding the "one branch per release", it indeed helps that it will cost nothing to make the branch in Git. But the main advantage is how well merge will be managed: http://stackoverflow.com/questions/612580/how-does-git-solve-the-merging-problem/612747#612747
VonC