使用tortoiseHg导入包含针对mercurial存储库的冲突更改的修补程序 [英] Import patches with conflicting changes for mercurial repository with tortoiseHg

查看:511
本文介绍了使用tortoiseHg导入包含针对mercurial存储库的冲突更改的修补程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成功导入补丁而没有相互冲突的更改。但是当我尝试导入具有冲突变化的补丁时,它会抛出一个错误,说Hunk#1 FAILED at 11 ..。合并更改没有选项。还有其他方法可以实现吗?

I have successfully imported patches without having conflicting changes. But when I try to import patch with conflicting changes it throws an error saying "Hunk #1 FAILED at 11.. ". There is no option to merge changes. Is there any other way to accomplish this?

推荐答案

手动解析



最新版本的TortoiseHg 2.1具有帮助您解决补丁中被拒绝块的工具。当您应用补丁并且它有拒绝时,对于每个拒绝的文件,它会询问您是否要解决被拒绝的块。如果单击是,它将显示一个屏幕,其中包含文件内容(已应用成功的块)以及每个被拒绝的块,以允许您更轻松地手动执行更改并将每个更改为已解决。

Manual resolution

The latest versions of TortoiseHg 2.1 have tools for helping you resolve rejected chunks from patches. When you apply a patch and it has rejections, for each file with rejections it asks if you want to resolve rejected chunks. If you click Yes, it shows you a screen with the content of the file (with successful chunks applied) as well as each chunk that was rejected, to allow you to manually do the changes a little easier and mark each as resolved.

我有时处理大量拒绝的方式是修改补丁。在TortoiseHg 1.x中,我可以选择一个节点,右键单击另一个节点并实际修改补丁。在TortoiseHg 2.x中,他们还没有重新添加,但解决方法并不是那么糟糕。您仍然可以使用 hg rebase 在命令行上修改补丁。在任何一种情况下,您都需要启用 mq rebase 扩展(并且您可能已经启用了前者)。这个答案不是教授如何使用 mq rebase 的地方(还有很多其他答案和文章,这样做,所以我会假设他们熟悉它们。

The way that I sometimes handle large rejections is to rebase the patch. In TortoiseHg 1.x I could select one node, right-click on another and actually rebase patches. In TortoiseHg 2.x they have not yet added that back in, but the workaround isn't so bad. You can still rebase patches on the commandline using hg rebase. In either case, you need the mq and rebase extensions enabled (and you probably already have the former enabled). This answer is not a place for teaching how to use mq or rebase (there are plenty of other answers and articles that do that), so I will be assuming some familiarity with them.

在这两者中,你需要将补丁应用到它所基于的修订版(或者一个适用于干净或接近干净的地方。)

In both, you will need to apply the patch to the revision on which it was based (or to one where it applies cleanly or close to clean).

命令行:


  1. 运行 hg rebase -s patchRev -d tip 以及 rebase 命令所需的任何其他开关。

  1. Run hg rebase -s patchRev -d tip. Along with whatever other switches you want on the rebase command.

这将带来你的3向合并工具解决了每个文件的冲突。

This will bring up your 3-way merge tool to resolve conflicts, for each file.

运行 hg qrefresh 到确保合并结果更新到补丁中。

Run hg qrefresh to make sure the merge results are updated into the patch.

TortoiseHg UI


  1. 将补丁作为正常变更集完成。

  2. 将变更集重新设置到提示上:

    • 更新提示。这很重要,因为它用于设置rebase操作的目标。

    • 右键单击临时变更集并选择 Rebase 以显示Rebase对话框。

    • 检查来源和目的地是否正确,然后点击继续。如果存在合并冲突,请点击显示的已解决的链接以打开解决对话框。

    • 点击 Mercurial Resolve 以设置Mercurial尝试自动解决一些冲突。

    • 对于任何其他仍然使用工具解析以显示所选文件的3向合并。

    • 解决所有问题后,点击解决对话框中的关闭

    • 点击继续然后关闭

  1. Finish the patch as a normal changeset.
  2. Rebase that changeset onto the tip:
    • Update to the tip. This is important as it used to set the target of the rebase operation.
    • Right-click on the temporary changeset and select Rebase to bring up the Rebase dialog.
    • Review that source and destination are correct, and click Continue. If there are merge conflicts, click on the resolved link that appears to open the Resolve dialog.
    • Click Mercurial Resolve to let Mercurial try to automatically resolve some conflicts.
    • For anything else that remains use Tool Resolve to bring up 3-way merge for selected files.
    • Once all are resolved, click Close on the Resolve dialog.
    • Click Continue and then Close on the Rebase dialog.

我更喜欢后一种方法用于更麻烦的实例,因为它默认情况下会阻止Mercurial自动解决冲突。它允许我选择解析文件的顺序以及我如何解决它们,显示每个步骤的进度状态。

I prefer the latter method for the more troublesome instances because it by default prevents Mercurial from automatically resolving conflicts. It allows me to choose the order in which I resolve files and how I resolve them, showing the status of my progress with each step.

这篇关于使用tortoiseHg导入包含针对mercurial存储库的冲突更改的修补程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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