开发者

Mercurial workflow to deal with sudden high priority tasks

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:

  1. Do an update, bringing me back to the merge commit.
  2. Do the fix and commit it.
  3. 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?


The workflow you're describing looks good (update to merge, commit, push -r the fix). If you feel not comfortable with anonymous branches, you can first clone -r the repo up to the merge, commit and push.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜