mercurial:将错误的更改从稳定的命名分支应用于dev分支 [英] mercurial: apply a bugfix change from stable named branch to dev branch

查看:76
本文介绍了mercurial:将错误的更改从稳定的命名分支应用于dev分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的仓库中有这两个命名的分支.稳定和开发.我的问题是如何将稳定更改的错误修正补丁复制到dev分支?我真的很想在框架内做到这一点,而不需要任何扩展:)

i have these two named branches in my repo. Stable and dev. My question is how do i copy a bugfix patch that was changed in stable to the dev branch? i would really like to do this within the framework and not with any extension :)

编辑

我为这个问题设置了赏金,因为我真的想要解决方案.有一个不错的解决方案,但被搁置了一半.所以我别无选择.现在看来已经被回答了.但是,如果有人有更好的解决方案,我将在第二天让这个问题公平.希望这是有道理的. :)

I set a bounty for the question because i really wanted the solution. There was a nice solution but was left mid way. So i had no other option. It now appears to have been answered. But i will let the question fair another day, just in case someone has a better solution. Hope that makes sense. :)

推荐答案

增加

To augment Tim's answer, a different way to approach it is how the Mercurial recommend you do it if you can, plan ahead (I'll see if I can rustle up a link.)

该计划的目的是,如果您知道某个错误修正/更改必须进入多个分支,则无需将该更改集提交到其中一个开始的地方,而可以在其他地方进行.

The plan goes that if you know that a bugfix/change has to go into several branches, you don't commit that changeset into one of those places to begin with, you do it somewhere else.

由于您要修复错误,因此在项目历史记录中的某个地方,便引入了该错误.

Since you're fixing a bug, somewhere in the history of the project, that bug was introduced.

由于错误修正需要进入多个分支,因此某个位置"必须在分支点之前,否则错误将不会在两个(/所有)分支中出现.

And since the bugfix needs to go into more than one branch, that "somewhere" has to be before the point where you branched, otherwise the bug wouldn't be in both (/all) branches.

因此,推荐的方法是修复引入该错误的错误,然后将该变更集合并到需要它的每个分支中.

So, the recommended way is to fix the bug where it was introduced, and then merge that changeset into each of the branches that needs it.

让我们看一个例子,我们有defaultstable个分支:

Let's look at an example, we have default and stable branches:

1---2---3---4---5---6---7---8---9---10       default
         \               \
          \               \
           11--------------12--13            stable

然后,您发现变更集2引入了一个错误,该错误修正需要同时应用于defaultstable.在问题中描述它的方式看起来像是要这样做:

Then you discover that changeset 2 introduced a bug, and the bugfix needs to be applied to both default and stable. The way you describe it in the question, it looks like you would do this:

1---2---3---4---5---6---7---8---9---10--15       default
         \               \             /^-- merge stable into default
          \               \           /
           11--------------12--13----14          stable
                                     ^-- bugfix

但是这也会将变更集13合并到default中.如果您不希望发生这种情况,则可以这样做:

But this would merge changeset 13 into default as well. If you don't want that to happen, you would instead 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

有关在错误修正情况下如何使用Mercurial的详细信息,请非常值得一读.

For more information on how to use Mercurial in bugfixing-scenarios, the 9th Chapter of 'Mercurial: The Definitive Guide' is well worth the read.

这篇关于mercurial:将错误的更改从稳定的命名分支应用于dev分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆