Yesterday a bug was discovered in one of our production sites. The production site runs many Mercurial revisions behind the current preproduction head. We needed a way to fix the bug for the production site without requiring it update any further than that commit.
This post explains how we accomplished this task, which for some is a daily routine.
Mercurial graphlog extension
When running Mercurial from a terminal, the bundled graph log extensionis our favourite way to see an ascii drawing of our commit history. It really is a great extension to the default log command.
First: we updated to the tagged production head. Second: we applied the bug fix (and in the process created new head and branch). Third: we merged with the next descendant from the old production head. This was us merging back into the ‘mainline’.
At this point you will be left with two heads still. To remove that final head, we merged our changes with the master branch tip
Now to get that bug fix onto the production server, we need to update the code (hg up) to the revision where we merged back into the ‘mainline’. This revision contains only the bug fix changes.