37

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

4

6 回答 6

40

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.

于 2008-10-04T16:48:49.697 回答
15

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

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

这一行告诉 mercurial p4merge 接受它的参数的顺序。

于 2008-12-29T23:39:43.350 回答
15

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

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

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

截屏

于 2010-09-23T14:38:49.957 回答
3

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

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

启用“ExtDiff”扩展:

[extensions]
hgext.extdiff =

添加了 P4 extdiff 命令:

[extdiff]
cmd.p4diff = p4merge

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

[tortoisehg]
vdiff = p4diff
于 2010-02-22T13:57:05.763 回答
0

我使用以下 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]))

我不确定启动外部差异工具的外观如何?希望它就像将上一行中的 2 和 5 调整为“签入”和“当前工作副本”的参数索引一样简单。

于 2008-09-10T14:48:23.290 回答
0

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

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

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

于 2008-09-04T06:11:02.480 回答