Mercurial回滚和重建 [英] Mercurial Rollback and Rebuild
问题描述
我们有2个Mercurial命名分支,开发和测试.开发中发生了许多更改,这些更改应该合并到测试中.某一时刻,更改被合并,然后回滚.然后,可能已尝试以错误的方向进行合并.结果是,我们现在有2个分支,并且最近的一个公共父分支.而且,我们仍有一些尚待测试的开发变更.但是由于我们和共同的父母所犯的错误,将开发合并到测试无法执行任何操作,也就是说,它不做任何更改.
We have 2 mercurial named branches, development and test. There have been many changes to development that were supposed to be merged up into test. At one point the changes were merged up and then rolled back. Then the merge may have been attempted in the wrong direction. The result is that we now have 2 branches with a recent common parent. And we still have changes in development that are not in test. But due to the mistakes we made and the common parent, merging development to test does nothing, i.e. it applies no changes.
如果我愿意再参加几周的考试,我是否可以像这样切换到考试分支:
If I'm willing to take test back a couple weeks, is it possible for me to switch to the test branch like this:
hg update <last good test revision>
然后从开发人员移植到本地"到我们要测试的十几种更改,然后合并到开发中以重置公共父级进行测试?
Then 'graft to local' from dev the dozen or so changes we want to move to test, then merge in development to reset the common parent for test?
这是一个疯狂的计划还是更简单的方法?
Is this a crazy plan or is there an easier way?
推荐答案
如果只是一打左右的更改,您确实可以update to good test rev
重新开始,并graft to local
重新创建完美分支所需的提交.
If it is just a dozen or so changes, you can indeed update to good test rev
to start fresh and graft to local
the commits you need to recreate the perfect branch.
Once and only once you are satisfied with your new banch head, use this trick to merge the two heads and ignore the bad test
head. You need to have a single head on your branch.
现在您将处于一种状态,即test
将保留development
分支中的所有更改.我建议您再次使用相同的技巧来合并development
,以使您成为test
的共同父代,但又不要在development
中发生所有污染.如果不起作用,只需在development
上进行一个虚拟更改集,然后重试此技巧(如果可行).
Now you'd be in a state that test
would hold all the changes from the development
branch. I suggest you use the same trick once more to merge development
in, to make the common parent for test
you need, but without all the pollution that may have taken place in development
. If it does not work, simply make a dummy changeset on development
and retry the trick again (if it makes sense).
但是,最后,您似乎并不太担心development
分支会被test
分支污染.在这个方向上还可以吗?
In the end, however, you don't seem too worried about the development
branch being polluted by the test
branch. Is it ok in that direction?
这篇关于Mercurial回滚和重建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!