Code Promotion with Subversion

svn

I'm working on migrating our dev team to Subversion and improving our repository structure and processes. We're basically going with the standard trunk/branches/tags setup. I was originally planning on using a release branches strategy (branches/1.0, branches/2.0, etc), but am now leaning toward a code promotion model (test and production branches). It's a little better and more intuitive for how our team works, but releases will be a little less straight-forward: we effectively need the test branch to become the production branch. (The production branch is always available for maintenance releases, but the test branch doesn't need to exist between deployment of one release and test-ready of the next.)

Can anyone who is using code promotion recommend the best way to implement promoting a branch from test to production? I figure these are my options, but don't know if they have major pros/cons:

a. Fully merge test branch into production branch, delete test branch
b. Delete production branch, copy test to production, delete test branch
c. Delete production branch, rename test branch to production

Thanks for any advice!

Best Answer

first: option b) and c) are the same in subversion as in subversion renames are in fact copy and delete.

That said you only have two choices:

  1. Fully merge test branch into production branch, delete test branch

    This is the clean way in terms of subversion. You can see in you svn log which revisions had merged into production and everybodys workingcopy stays intact.

    But it comes with a price: You have to manually do the merges and resolve potential conflicts(if changes in productionbranch occur).

    However you can usually do this with a small amount of overhead

  2. Delete production branch, rename test branch to production

    This is the easy way, because you just do a very small operation which is scriptable.

    Disadvantages:

    You will invalidate all workingcopys which were pointing to testbranch(which has become production!)

    Merge tracking is much more difficult, as you cannot review the old production branch easily. Direct changes in production branch are lost(without notification)!

Also keep in mind that you may do not want all commits in testbranch in production(why did you test, if everything goes fine?). So I would strongly suggest option A