The scenario is that I arrive at work one morning and pull, update, merge my mercurial tree. From the now latest revision I begin working on todays task. I reach a logical milestone and does a commit. The tree now looks like this:
* <- my first commit for the day
|
* <- merge commit from shared repos by team
Now the boss comes along, something horrible has happened and it needs my immediate attention. He wants the solution pushed asap.
My plan for the day is disrupted. What is the best way to use mercurial to tackle this problem?
- I could just write the solution and make another commit followed by a push. But this is bad since that commit would have my own first commit as parent, thus pushing incomplete code.
- In a perfect world maybe that new feature Im coding will be in its own branch. But its a small feature and Im lazy, so it currently resides in
default
. I could try to find a way to move a commit from one branch to another. - I could ignore the panicking boss, do two or three more commits to complete the feature, push that and then start working on the fix, bringing those in as a separate commit and push.
Neither of those feels good. I would like something along the lines of:
- Do an update, bringing me back to the merge commit.
- Do the fix and commit it.
- Push only the fix commit, leaving the incomplete-feature commit still unpushed.
Thus making the history like this:
* <- fix commit (pushed)
|
| * <- my first commit for the day (unpushed)
|/
* <- merge commit from shared repos by team
We've just migrated to mercurial here at the office, and this is one problem I would like to tackle. Any mercurial gurus here that mind sharing some wisdom?