To increase Tim’s answer , another way to get closer to him is how Mercurial recommends you do it, if you can, plan ahead (I’ll see if I can rustle the link.)
The plan says that if you know that an error / change should be sent in several branches, you are not making this set of changes in one of these places to start, you are doing it somewhere else.
Since you are fixing a bug somewhere in the history of the project, this bug has been introduced.
And since you need to go to more than one branch to correct errors, it should be somewhere until the moment you branch, otherwise the error will not be in both branches (/ all).
So, the recommended way is to fix the error where it was introduced, and then merge this set of changes into each of the branches that it needs.
Let's look at an example, we have the default and stable branches:
1---2---3---4---5---6---7---8---9---10 default \ \ \ \ 11--------------12--13 stable
Then you will find that changeet 2 introduced the error, and the fix should apply to both default and stable . The way you describe this in the question, it looks like you will do this:
1---2---3---4---5---6---7---8---9---10--15 default \ \ /^-- merge stable into default \ \ / 11--------------12--13----14 stable ^-- bugfix
But this will merge changeet 13 into default . If you do not want this to happen, you must do this:
v-- bugfix 14--------------------------+--+ / | \ / | \ 1---2---3---4---5---6---7---8---9--x-10--15 default \ \ | ^-- merge 14 into default \ \ | 11--------------12--13--16 stable ^-- merge 14 into stable
For more information on how to use Mercurial in error correction scenarios, the 9th chapter of the Mercurial: The Definitive Guide is well worth the read.