Linux Mercurial Diff Merge:这是什么工具,我如何使用它?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6097578/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 04:13:17  来源:igfitidea点击:

Mercurial Diff Merge: What tool is this and how do I use it?

linuxvimmercurialdiffversion

提问by HyderA

I am new to mercurial, I am quite familiar with TortoiseHG, but this is the first time I am managing a project in a headless linux environment. I do an hg updateafter a push, and I get this screen:

我是 mercurial 的新手,我对 TortoiseHG 非常熟悉,但这是我第一次在无头 linux 环境中管理项目。我做了hg update一个推后,我得到这个屏幕:

enter image description here

在此处输入图片说明

Help section says it's vim, how do I go about merging my application.

帮助部分说它是 vim,我该如何合并我的应用程序。

采纳答案by Mark Drago

This is vimdiff. You can learn more about it by running man vimdiff.

这是vimdiff。您可以通过运行了解更多信息man vimdiff

However, I would recommend using mercurial's internal:merge tool. It will perform the merge and, if a conflict occurs, insert conflict markers in the file and notify you that there was a conflict. You then open up the file, resolve the conflict, remove the conflict markers, mark the file as resolved, and when all files are cleaned up you can commit the result of the merge. This is very similar to how subversion handles conflicts. You can configure mercurial to use internal:merge by adding the following to your ~/.hgrc file:

但是,我建议使用 mercurial 的 internal:merge 工具。它将执行合并,如果发生冲突,则会在文件中插入冲突标记并通知您存在冲突。然后打开文件,解决冲突,删除冲突标记,将文件标记为已解决,当所有文件都被清理干净后,您可以提交合并的结果。这与 subversion 处理冲突的方式非常相似。您可以通过将以下内容添加到 ~/.hgrc 文件来配置 mercurial 以使用 internal:merge:

[ui]
merge=internal:merge

The tool you'll use to get the list of conflicted files and mark them resolved is called hg resolve, so I would recommend running hg help resolveto learn more about that tool. You can learn more about mercurial's support for merge tools by running: hg help merge-tools.

您将用于获取冲突文件列表并将其标记为已解决的工具称为hg resolve,因此我建议运行hg help resolve以了解有关该工具的更多信息。您可以通过运行以下命令了解有关 mercurial 对合并工具的支持的更多信息:hg help merge-tools

回答by eckes

Seems like you need some help in using Vim's diff module. See one of these:

似乎您在使用 Vim 的 diff 模块时需要一些帮助。请参阅其中之一:

If you're not comfortable using Vim, there's surely an option that lets you specify your own favourite diff tool, but I don't know HG, so I can't tell you which option you'll have to modify.

如果您不习惯使用 Vim,那么肯定有一个选项可以让您指定自己喜欢的 diff 工具,但我不知道 HG,所以我无法告诉您必须修改哪个选项。

The opened Vim has three files being diffed, so I guess you ran into some conflicts when doing the hg update.

打开的 Vim 有三个文件被差异化,所以我猜你在执行hg update.

回答by Mekk

From my experience, the tool which is - by far - easiest to use for most people is kdiff3 (intuitive menu, natural view with base and both tips above and resulting text below, good keyboard shortcuts - Ctrl-1/Ctrl-2/Ctrl-3 to pick snippet from first/second/third window, Ctrl-arrows to jump from conflict to conflict). Just install this program and give it highest priority in merge-tools configuration (set

根据我的经验,到目前为止,大多数人最容易使用的工具是 kdiff3(直观的菜单、带有基础的自然视图以及上方的提示和下方的结果文本,良好的键盘快捷键 - Ctrl-1/Ctrl-2/Ctrl -3 从第一个/第二个/第三个窗口中选择片段,Ctrl-箭头从冲突跳转到冲突)。只需安装此程序并在合并工具配置中为其赋予最高优先级(设置

[merge-tools]
kdiff3.priority=1000

).

)。

In general: whichever tool you use, it shows you conflicted versions of the file and expects you to create the final version.

一般而言:无论您使用哪种工具,它都会向您显示文件的冲突版本,并希望您创建最终版本。