Have you been in a operational environment where multiple development streams each with unique functionality are in development but the release to production dates are not in a definitive sequence. Or perhaps, an incremental release development model where the development is broken into blocks that are larger than any sprint/iteration. These are examples of the scenarios whereby the question of when to merge the development in the configuration management tool branch becomes an acute question. The timing of the merge to the trunk places the operations or project manager in a position whereby the production environment cannot be updated until the new functionality is also deployed. This becomes an increasingly acute problem when the number of changes in production is higher, of high priority, or the size of the new functional release increases as the regression test cycle is necessarily longer. So how do we solve this problem?
Traditionally, we have merged the branches to the trunk and built our pre production testing environment from the trunk which creates the circumstances noted above. I suggest reversing that model.
As changes are made in the trunk (production) merge those changes out to the branch(s). This creates in the branch(s) a code baseline that is identical to the future production environment and relieves the need to know definitively the order in which the branch(s) will be deployed to production. It also creates in the branch a code baseline that is identical to the future production state but is in the branch and not the trunk so the capability to update production with either high priority fixes or any other branch remains. In this instance, the issues associated with merging of the new functionality to the production baseline are flushed out in the branch by building the pre-production testing environments from the branch and testing.
Once the functionality is flushed out in the branch and this branch is determined to be the next going to production, then the branch is merged to the trunk, regression testing and release to production occur. By testing out in the branch, the regression testing from the trunk (after the merge) is greatly reduced thus minimising the risk of production maintenance during the regression testing window. The positive side effect is the decision on which new functional release will go to production is delayed until after the functional testing in the branch and easing any decisions in this area.
The downside to this approach is more maintenance of code out in the branches. The decision becomes a trade-off between the risks associated with longer regression test cycles and the inability to maintain production during this cycle with the additional effort associated with maintaining the branches. In those circumstances where there are a lot of high priority updates in production and/or the new releases are large, numerous, or have long regression test cycles, I suggest considering this alternative approach.