如何使用 p4merge 作为 Mercurial 的合并/比较工具?

发布于 2024-07-05 08:10:29 字数 235 浏览 8 评论 0原文

有谁知道如何设置 Mercurial 来使用 p4merge 作为 OS X 10.5 上的合并/差异工具?

Does anyone know how to setup Mercurial to use p4merge as the merge/diff tool on OS X 10.5?

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

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

发布评论

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

评论(6

手心的温暖 2024-07-12 08:10:31

我使用以下 Python 代码来启动 p4merge 并将其与 git 一起使用:

#!/usr/bin/python
import sys
import os

os.system('/Applications/p4merge.app/Contents/MacOS/p4merge "%s" "%s"' % (sys.argv[2], sys.argv[5]))

我不确定 Mercurial 启动外部 diff 工具的效果如何? 希望它像调整 2 & 一样简单。 上一行中的 5 是“签入”和“当前工作副本”参数的索引。

I use the following bit of Python to launch p4merge and use it with git :

#!/usr/bin/python
import sys
import os

os.system('/Applications/p4merge.app/Contents/MacOS/p4merge "%s" "%s"' % (sys.argv[2], sys.argv[5]))

I'm not sure how mercurial looks to launch an external diff tool though ? Hopefully it's as simple as adjusting 2 & 5 in the above line to being the index of the arguments for 'checked in' and 'current working copy'.

灰色世界里的红玫瑰 2024-07-12 08:10:30

这将适用于合并:

将其放入您的 ~/.hgrc(或者,Windows 上的 Mercurial.ini):

[merge-tools]
p4.priority = 100
p4.premerge = True  # change this to False if you're don't trust hg's internal merge
p4.executable = /Applications/p4merge.app/Contents/MacOS/p4merge
p4.gui = True
p4.args = $base $local $other $output

需要 Mercurial 1.0 或更高版本。 显然,您需要更新该可执行文件的路径以反映 p4merge 的安装位置。


您无法更改 hg diff 使用的内容; 但是您可以使用extdiff扩展来创建使用您想要的显示的新diff命令。

所以 hg pdiff 可以运行 p4 merge 等。

This will work for merging:

Place this into your ~/.hgrc (or, optionally, your Mercurial.ini on Windows):

[merge-tools]
p4.priority = 100
p4.premerge = True  # change this to False if you're don't trust hg's internal merge
p4.executable = /Applications/p4merge.app/Contents/MacOS/p4merge
p4.gui = True
p4.args = $base $local $other $output

Requires Mercurial 1.0 or newer. Clearly you'll need to update the path to that executable to reflect where you'd got p4merge installed.


You can't change what hg diff uses; but you can use the extdiff extension to create new diff commands that use the display you want.

So hg pdiff could run p4 merge, etc.

世界如花海般美丽 2024-07-12 08:10:30

我发现 Ry4an 的答案是这是一个很好的解决方案,除了一个小问题,它使 p4merge(在 mac os 下)混淆了命令输入。 执行他的答案中描述的所有操作< /a> 并在 [merge-tools] 部分添加以下行

p4.args=$base $local $other $output

此行告诉 Mercurial p4merge 采用其参数的顺序。

I found Ry4an's answer to be a good solution, except for a minor problem, which left p4merge (under mac os) mixing up the command inputs. Do everything described in his answer and add the following line in the [merge-tools] section:

p4.args=$base $local $other $output

This line tells mercurial in which order p4merge takes its arguments.

清醇 2024-07-12 08:10:30

也许是因为我在 Windows 上工作,但建议的解决方案对我不起作用。 相反,以下内容确实有效。

在您的 ~/.hgrc/ / Mercurial.ini 中,我应用了以下更改:

启用“ExtDiff”扩展:

[extensions]
hgext.extdiff =

添加了 P4 extdiff 命令:

[extdiff]
cmd.p4diff = p4merge

将其配置为默认视觉差异工具:

[tortoisehg]
vdiff = p4diff

Maybe because I'm working on Windows, but the proposed solution didn't work for me. Instead, the following does work.

In your ~/.hgrc/ / Mercurial.ini, I applied the following changes:

Enabled "ExtDiff" extension:

[extensions]
hgext.extdiff =

Added P4 extdiff command:

[extdiff]
cmd.p4diff = p4merge

Configured it as the default visual diff tool:

[tortoisehg]
vdiff = p4diff
暖伴 2024-07-12 08:10:30

我猜有一个用于 p4merge 的 CLI 工具(我对此一无所知)。

我写了一篇关于使用 Changes.app 和 Mercurial 的其他一些 GUI 工具的博客文章:将 Mercurial 与 GUI 工具结合使用。

基本上,您需要了解加载 diff 工具的 CLI 工具的调用期望。 IE,如何使其从特定文件加载数据,以及如何使其等待退出。 帖子上应该有足够的信息来给你一些想法。

I'm guessing there's a CLI tool for p4merge (which I know nothing about).

I wrote a blog post about using Changes.app, and some other GUI tools with Mercurial: Using Mercurial with GUI Tools.

Basically, you need to know the calling expectations of the CLI tool that loads up the diff tool. IE, how to make it load data from a particular file, and how to make it wait for exit. There should be enough info on the post to give you some ideas.

情深缘浅 2024-07-12 08:10:30

我使用的是 TortoiseHg 1.0.1 版本,p4merge 开箱即用。

只需进入全局设置 -> TortoiseHg 并选择以下选项:

  • 三向合并工具:p4merge
  • 视觉差异工具:p4merge

Screenshot

I am using version 1.0.1 of TortoiseHg and p4merge works out of the box.

Just go to Global Settings -> TortoiseHg and select the following options:

  • Three-way Merge Tool: p4merge
  • Visual Diff Tool: p4merge

Screenshot

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