Mercurial Diff Merge:这是什么工具以及如何使用它?
我是 Mercurial 的新手,对 TortoiseHG 相当熟悉,但这是我第一次在无头 Linux 环境中管理项目。我在推送后执行 hg update
,然后看到以下屏幕:
帮助部分说它是 vim,我该如何合并我的应用程序。
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 update
after a push, and I get this screen:
Help section says it's vim, how do I go about merging my application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是 vimdiff。您可以通过运行
man vimdiff
了解更多信息。不过,我建议使用mercurial的internal:merge工具。它将执行合并,如果发生冲突,则在文件中插入冲突标记并通知您存在冲突。然后,您打开文件,解决冲突,删除冲突标记,将文件标记为已解决,当所有文件都清理完毕后,您可以提交合并结果。这与 subversion 处理冲突的方式非常相似。您可以通过将以下内容添加到 ~/.hgrc 文件来将 Mercurial 配置为使用内部:合并:用于
获取冲突文件列表并将其标记为已解决的工具称为
hgsolve
,因此我建议运行hg helpsolve
来了解有关该工具的更多信息。您可以通过运行:hg help merge-tools
来了解有关 Mercurial 对合并工具的支持的更多信息。This is vimdiff. You can learn more about it by running
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:
The tool you'll use to get the list of conflicted files and mark them resolved is called
hg resolve
, so I would recommend runninghg help resolve
to learn more about that tool. You can learn more about mercurial's support for merge tools by running:hg help merge-tools
.看来您在使用 Vim 的 diff 模块方面需要一些帮助。请参阅其中之一:
如果你不习惯使用 Vim,肯定有一个选项可以让你指定你自己最喜欢的 diff 工具,但我不知道 HG,所以我可以'我不会告诉您必须修改哪个选项。
打开的 Vim 有三个文件正在比较,所以我猜你在执行
hg update
时遇到了一些冲突。Seems like you need some help in using Vim's diff module. See one of these:
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.
The opened Vim has three files being diffed, so I guess you ran into some conflicts when doing the
hg update
.根据我的经验,到目前为止,对大多数人来说最容易使用的工具是 kdiff3(直观的菜单,带有基础的自然视图以及上面的提示和下面的结果文本,良好的键盘快捷键 - Ctrl-1/Ctrl-2/Ctrl -3 从第一个/第二个/第三个窗口中选择片段,Ctrl-箭头从一个冲突跳转到另一个冲突)。只需安装此程序并在合并工具配置(设置
)中给予它最高优先级。
一般来说:无论您使用哪种工具,它都会向您显示文件的冲突版本,并期望您创建最终版本。
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
).
In general: whichever tool you use, it shows you conflicted versions of the file and expects you to create the final version.