Mercurial工作流程处理突发的高优先级任务
场景是,我一天早上上班并拉取、更新、合并我的 Mercurial 树。从现在最新的修订版开始,我开始处理今天的任务。我达到了一个逻辑里程碑并进行了提交。这棵树现在看起来像这样:
* <- my first commit for the day
|
* <- merge commit from shared repos by team
现在老板出现了,发生了一些可怕的事情,需要我立即关注。他希望尽快推出解决方案。
我今天的计划被打乱了。使用 Mercurial 解决这个问题的最佳方法是什么?
- 我可以编写解决方案并进行另一次提交,然后进行推送。但这很糟糕,因为该提交将以我自己的第一次提交作为父提交,从而推送不完整的代码。
- 在一个完美的世界中,也许我编码的新功能将在它自己的分支中。但它是一个小功能,而且我很懒,所以它目前位于
default
中。我可以尝试找到一种方法将提交从一个分支移动到另一个分支。 - 我可以忽略惊慌失措的老板,再进行两到三个提交来完成该功能,推送它,然后开始修复,将它们作为单独的提交和推送。
这些都感觉不好。我想要一些类似的东西:
- 进行更新,让我回到合并提交。
- 进行修复并提交。
- 仅推送修复提交,而不完整功能提交仍未推送。
因此,历史是这样的:
* <- fix commit (pushed)
|
| * <- my first commit for the day (unpushed)
|/
* <- merge commit from shared repos by team
我们刚刚在办公室迁移到 Mercurial,这是我想要解决的一个问题。这里有哪位善变的大师愿意分享一些智慧吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您描述的工作流程看起来不错(更新以合并、提交、push -r 修复)。如果您对匿名分支感到不舒服,您可以首先克隆 -r 存储库以进行合并、提交和推送。
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.