如何解决这种水银冲突? [英] How resolve this Mercurial conflict?

查看:110
本文介绍了如何解决这种水银冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Mercurial和Python感到沮丧,因为它使简单的事情变得困难.我发生了一些小冲突,而且由于Mercurial没有给出任何建议,我什至不知道该如何解决这种小文件冲突:

I'm frustrated with Mercurial and Python since it makes easy things difficult. I have a trivial conflict and since Mercurial does not give any suggestion what to do I don't know even how to resolve this trivial file conflict:

冲突是微不足道的,但是如果我不能解决这个问题,那么我也无法解决任何复杂的事情.我可以按照自己想要的方式编辑文件,然后从任何地方再次提交吗?我应该运行hg merge吗?为什么Mercurial甚至不能让我选择要保留的版本?为什么要不仔细阅读1000篇写得不好的手册,就几乎不可能做些琐碎的事?

The conflict is trivial but if I can't resolve this I can't resolve anything complicated either. Can I just edit the file to a way I want and commit it again from anywhere? Should I run hg merge? Why can't Mercurial even let me choose a version to keep? Why is something trivial near impossible to do without digging through 1000 poorly written manpages?

推荐答案

您需要查看 KDiff3文档,特别是关于合并和输出窗口的部分 .要解决冲突,您需要确定livejanuary是该行的正确选择.该决定是您要做出的,没有工具可以知道您是一个人还是另一个人.

You need to look at the KDiff3 documentation, in particular the section on merging and the output window. To resolve the conflict, you need to decide if live or january is the right choice for the line. That decision is yours to make, no tool can know if you meant one or the other.

在KDiff3中,按 Ctrl + 2 选择live,然后按 Ctrl + 3 选择january或在底部窗口的空白处单击鼠标右键,然后选择所需的行.您也可以在底部窗口中单击并手动编辑该行.

In KDiff3, you press Ctrl + 2 to select live, press Ctrl + 3 to select january or right-click in the margin of the bottom window and select the line you want. You can also click in the bottom window and edit the line manually.

Mercurial让您以任意方式配置您的合并工具. TortoiseHg附带了默认配置,该配置将KDiff3放在列表的顶部,但是您可以根据需要使用其他工具.合并工具实际上只是一个程序,它接受四个文件名:要比较的三个文件(基本,父1,父2)和输出文件名.

Mercurial let's you configure your merge tool any way you like. TortoiseHg ships with a default configuration that puts KDiff3 in the top of the list, but you can use another tool if you like. A merge tool is really just a program that accepts four filenames: the three files to compare (base, parent 1, parent 2) and an output file name.

要解决命令行上的冲突,您需要启动合适的命令行三向合并工具.如果愿意,您可以例如与vim合并. (恐怕我对vimdiff一无所知,我自己使用KDiff3.)

To resolve conflicts on the command-line you need to launch a suitable command-line three-way merge tool. You can for example merge with vim if you like. (I'm afraid I don't know anything about vimdiff, I use KDiff3 myself.)

如果您不希望弹出合并工具,则可以设置

If you don't like to see merge tools pop up, then you can set

[ui]
merge = internal:merge

使Mercurial仅使用内部三方合并.当编辑没有冲突时,它将合并文件很好.发生冲突时,文件被标记为未解决",并且冲突标记存储在文件中.

to make Mercurial use the internal three-way merger only. It will merge files fine when the edits are not in conflicts. When there is a conflict, the file is marked as "unresolved" and conflict markers are stored in the file.

然后,您需要手工编辑文件以获取所需的版本.您还可以重新合并并选择本地(您的)版本:

You then need to edit the file by hand to get the version you want. You can also re-merge and pick either the local (your) version:

$ hg resolve --tool internal:local your-file

或其他版本:

$ hg resolve --tool internal:other your-file

您完全可以使用hg resolve your-file重新启动合并.在提交文件之前,需要将其标记为已解决".这是通过hg resolve --mark your-file完成的.有关当前合并的状态,请参见hg resolve --list.

You restart the merge completely with hg resolve your-file. The file needs to be marked "resolved" before you can commit it. This is done with hg resolve --mark your-file. See hg resolve --list for the status of the current merge.

这篇关于如何解决这种水银冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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