8

6

I have read Joel's HG tutorial, it did answer several questions of mine but not this one: Would you merge dev and stable regularly after each bugfix in stable, or would you wait, accumulate several bugfixes, and merge them into the dev in one go? To explain a bit better, I created flowchart for them:

Merge always:

dev branch:  Version1 => feature1=>merged=>feature2=>merged=>feature3 => Version2
                 \ (clone)          /                /
stable branch:  Version1 =>    bugfix1  =>       bugfix2   

Merge late:

dev branch:  Version1 => feature1 => feature2 => feature3 => Version2
                 \ (clone)                                    / (merge)
stable branch:  Version1 =>  bugfix1  =>   bugfix2   =>   bugfix3  

So what would you recommend to follow?

flag

2 Answers

7

Merging often, as opposed to merging late, has a number of benefits over merging late:

  1. Merging often keeps code drift to a minimum because you are merging as soon as possible, so there are fewer opportunities for the other branch to drift away.
  2. Merging often means that the code you are merging is more fresh in one's mind, meaning that resolving any conflicts that do occur is easier because the code and what it is trying to accomplish is more familiar.
  3. Merging often makes it less likely that you will forget to merge the changes back in to the main line of development. If you wait, the possibility that you forget fixes have been made to the stable branch increases. By merging changes in right away, your change management process for releasing new versions from dev doesn't have to account for missed fixes coming from the stable line because they should have been merged into the development line as part of the fix. (However, as Jason points out, propagating things from the development line into stable and always releasing from stable avoids this)
link|flag
6

To be honest, the power of Mercurial is that either is really fine technically. As cdeszaq points out, however, there are some benefits to merging more frequently. Most of them revolve around making resolving conflicts a bit easier. But conflicts aren't all that likely when you are working on completely new features in the development branch, and bug fixes in the stable branch.

I would disagree with the concern about missing fixes in stable (#3). You can't really miss fixes if you always ship from the stable branch. That's because when you try to merge your changes from the development branch into stable, you won't have any choice but to pick up all of the changes that you've made there. It's literally impossible unless you bork the merge or you decide leave extra heads in the stable repository which Mercurial actively discourages.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.