September 18, 2009

Living on the Edge - Automated Merging (Part 3)

E-Commerce
Branching
Agile

There are a lot of things to consider if you want to automated merges. Here are just a few ...Continued from Living on the Edge - Automated Merging (Part 2). There are a lot of things to consider if you want to automated merges. Here are just a few:

  • Define tag names for each branch, e.g. FGS-3.0-R = //Eng/FGS/rel/3.0-R/...
  • Define merge paths between branches, e.g. FGS-3.0-R to MAIN.
  • Consider which merge paths are most appropriate for automated merging.
  • Provide a way for an admin to enable/disable each defined merge pathway.
  • Provide developers a way to avoid automerging particular changelists (e.g. with special text in the changelist description).
  • Sending email notifications when automatic merges occur, with a subject line indicating if it succeeded or if  interactive (human) resolution is required, etc.

As mentioned in Part 2, automated merging works best if automate merges from bugfix-only branches.  In more general terms, automated merging works best if the branch from which you're automatically merging changes contains focused changes, tightly controlled changes.  Things like general code cleanup will make for a mess, so it's best if that sort of activity occur in new development branches, not release maintenance branches. In branching strategies where products change extensively on long-lived release branches (as opposed to bugfix-only release branches), the success rate for automatic merges would likely be lower.  Automated merging may not be appropriate in that case.

Red = Refresh (Automatic?), Blue=Promote
Red = Refresh (Automatic?), Blue=Promote

Which paths should be automated?

Take a look at the diagram above. There's a lot going on there!  That depicts an advanced branching strategy involving a mainline, release branches (rel/*-R), integration branches (int/*-I), and development branches.  Start with automating merges from the release branches to MAIN only.  In the example above, the merge pathways from rel/8.5-R to rel/9.0-R and separately from 9.0-R to MAIN would be candidates for automated merging.  The remaining merges would be left to humans.

Personal development sandbox branches aren't shown to avoid clutter.  If sandboxes are used, allow developers to automate merges from development branches to their personal sandboxes.