修复 Mercurial 中的错误合并

发布于 2024-12-10 23:51:52 字数 387 浏览 0 评论 0原文

在我们的 Mercurial 项目配置中,我们在一个存储库中有 3 个分支。一种是稳定版本分支,其中完成紧急错误修复,一种是包含新功能代码的功能分支,一种是 UAT 分支,其中错误修复和新功能合并以提供最新的代码库。

我们已将大量新功能代码合并到 UAT 分支中,没有任何问题。接下来,我们将包含错误修复的稳定分支合并到 UAT 分支中,但这似乎具有删除新功能代码的效果。我发现这个问题是由某人将UAT合并到稳定版中引起的(这本来不应该发生!!)。现在,当我尝试将错误修复合并到 UAT 中时,它会删除所有新功能代码。

有没有一种方法可以消除从 UAT 合并到稳定版本的影响,同时仍然保留此“错误合并”之后的后代错误修复?我尝试过取消合并,但似乎根本没有效果。我可以进行剥离并重新添加所需的变更集吗?

提前致谢。

In our mercurial project configuration we have 3 branches in a single repository. One is a stable release branch where urgent bug fixes are done, one is a feature branch which contains new feature code and one is a UAT branch where both bug fixes and new features are merged into to provide the most up-to-date code base.

We have merged a whole load of new feature code into the UAT branch without any issues at all. Following that we merged the stable branch with the bug fixes into the UAT branch but this seems to have the effect of removing the new feature code. I have discovered that this problem has been caused by someone merging UAT into stable a while ago (which should have never happened!!). Now when I try to merge the bug fixes into UAT it removes all the new feature code.

Is there a way of removing the effects of the merge from UAT into stable, whilst still retaining the bug fixes that are descendents after this 'bad merge'? I've tried backing out the merge but it seems to have no effect at all. Can I do a strip and re-add the required changesets back in?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅笑轻吟梦一曲 2024-12-17 23:51:52

事实上,我已经通过一些尝试和错误自己成功地解决了这个问题。

首先,您需要在 Mercurial.ini 文件中启用移植和 mqMerge 扩展。在扩展标题下方添加以下行将

   transplant=
   mq=

存储库克隆到新位置。
在您的新存储库中,使用 strip 命令清除历史记录来删除错误合并,从而删除错误合并的影响。 (请注意,这将删除所有后代变更集)

然后,您需要使用类似于下面的命令从其他存储库中按时间顺序挑选所有必需的变更集,

    hg transplant -s "otherRepo" -b "branchName" "changesetHexNumber"

对所有必需的变更集重复移植命令。欧伊拉!

注意:如果您使用的是中央存储库,您也需要删除其中有问题的合并/变更集,否则您的本地存储库会认为您有未完成的变更集需要提取。

I've actually managed to fix this one myself through a bit of trial and error.

First you need to enable the transplant and mqMerge extensions in your mercurial.ini file. Add the lines following lines below the extension header

   transplant=
   mq=

Clone a your repository to a new location.
In your new repo, remove the bad merge by using the strip command to clear history the effect of the bad merge is removed. (Beware that this will remove all descendent changesets)

Then you need to cherrypick all the required changesets in chronological order from the other repo by using a command similar to below

    hg transplant -s "otherRepo" -b "branchName" "changesetHexNumber"

Repeat the transplant command for all the required changesets. Ouila!

NB: If you are using a central repository you will need to strip the offending merge/changset on there too otherwise your local repo will think you have outstanding changesets to pull.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文