使用 Mercurial 和 Beyond Compare 3(bc3) 作为 diff 工具?

发布于 2024-07-09 08:30:54 字数 938 浏览 6 评论 0原文

在 Windows 中,我可以使用 winmerge 作为 hg 的外部 diff 工具,使用 mercurial.ini 等。
使用一些您可以在网络上找到的选项开关(我认为这是一个日本网站) 无论如何,这里 例如:

hg winmerge -r1 -r2

将列出 winmerge 中 rev1 和 rev2 之间的文件更改。 我只需单击要比较的文件即可

,但对于 bc3:

hg bcomp -r1 -r2

将使 bc3 打开一个对话框,其中指出找不到临时目录。

我最多可以使用 bc3 和 hg 来

 hg bcomp -r1 -r2 myfile.cpp 

打开 myfile.cpp 的 rev1 和 rev2 之间的差异

,因此,hg+bc3 似乎无法成功确认修订版之间的所有文件更改。 一次只能比较 1 个文件。
任何人都可以更好地使用 bc3 + hg 吗?

编辑:问题解决了!

从 http://www.scootersoftware.com/support.php?zz=kb_vcs.php>scooter 支持页面获得解决方案。 我必须使用 bcompare 而不是 bcomp 这是我的 Mercurial.ini 的片段

[extensions]
hgext.win32text =

;mhd adds
hgext.extdiff = 

;mhd adds for bc
[extdiff]
cmd.bc3 = bcompare
opts.bc3 = /ro

;mhd adds for winmerge
;[extdiff]
;cmd.winmerge = WinMergeU
;opts.winmerge = /r /e /x /ub

in windows I am able to use winmerge as the external diff tool for hg using mercurial.ini,etc.

Using some options switch that you can find in web(I think it's a japanese website)
Anyway, here
for example:

hg winmerge -r1 -r2

will list file(s) change(s) between rev1 and rev2 in winmerge. I can just click which file to diff

but for bc3:

hg bcomp -r1 -r2

will make bc3 open a dialog which stated that a temp dir can't be found.

The most I can do using bc3 and hg is

 hg bcomp -r1 -r2 myfile.cpp 

which will open diff between rev1 and rev2 of myfile.cpp

So,it seems that hg+bc3 can't successfully acknowledge of all files change between revision.
Only able to diff 1 file at a time.

Anyone can use bc3 + hg better ?

edit: Problem Solved !

Got the solution from http://www.scootersoftware.com/support.php?zz=kb_vcs.php>scooter support page.
I have to use bcompare instead of bcomp
Here's a snippet of my mercurial.ini

[extensions]
hgext.win32text =

;mhd adds
hgext.extdiff = 

;mhd adds for bc
[extdiff]
cmd.bc3 = bcompare
opts.bc3 = /ro

;mhd adds for winmerge
;[extdiff]
;cmd.winmerge = WinMergeU
;opts.winmerge = /r /e /x /ub

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

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

发布评论

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

评论(9

稍尽春風 2024-07-16 08:30:54

Beyond-Compare-3 是一个了不起的工具。
我建议对设置进行一些调整:

[extensions]
extdiff =

[extdiff]
cmd.bcomp = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bcomp = /leftreadonly

[merge-tools]
bcomp.executable = C:\Program Files\Beyond Compare 3\BComp
bcomp.args = /leftreadonly /centerreadonly $local $other $base $output
bcomp.priority = 1

[ui]
merge = bcomp

[tortoisehg]
authorcolor = True
vdiff = bcomp

Beyond-Compare-3 is an amazing tool.
I recommend a few tweaks to the setup:

[extensions]
extdiff =

[extdiff]
cmd.bcomp = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bcomp = /leftreadonly

[merge-tools]
bcomp.executable = C:\Program Files\Beyond Compare 3\BComp
bcomp.args = /leftreadonly /centerreadonly $local $other $base $output
bcomp.priority = 1

[ui]
merge = bcomp

[tortoisehg]
authorcolor = True
vdiff = bcomp
负佳期 2024-07-16 08:30:54

我个人发现最好的 Beyond Compare 配置可以在 Mercurial mergetools.rc 文件 文件:

[merge-tools]
....
; Windows version of Beyond Compare
beyondcompare3.args=$local $other $base $output /ro /lefttitle=local /centertitle=base /righttitle=other /automerge /reviewconflicts /solo
beyondcompare3.regkey=Software\Scooter Software\Beyond Compare 3
beyondcompare3.regname=ExePath
beyondcompare3.gui=True
beyondcompare3.priority=-2
beyondcompare3.diffargs=/lro /lefttitle='$plabel1' /righttitle='$clabel' /solo /expandall $parent $child

我还发现extdiff 中包含 Beyond Compare 很重要 部分,因此它将使用 merge-tools 部分中的 beyondcompare3diffargs 参数。 (我在 ui.mergetortoisehg.vdiff 中指定了 beyondcompare3

Personally I found that the best Beyond Compare config can be found in the Mercurial mergetools.rc file file:

[merge-tools]
....
; Windows version of Beyond Compare
beyondcompare3.args=$local $other $base $output /ro /lefttitle=local /centertitle=base /righttitle=other /automerge /reviewconflicts /solo
beyondcompare3.regkey=Software\Scooter Software\Beyond Compare 3
beyondcompare3.regname=ExePath
beyondcompare3.gui=True
beyondcompare3.priority=-2
beyondcompare3.diffargs=/lro /lefttitle='$plabel1' /righttitle='$clabel' /solo /expandall $parent $child

I also found that it is important to NOT include Beyond Compare in extdiff section so it will use beyondcompare3 from the merge-tools section with diffargs arguments. (I have beyondcompare3 specified in both ui.merge and tortoisehg.vdiff)

半世晨晓 2024-07-16 08:30:54

我必须添加以下内容才能使其在我的机器上运行:

[extensions]
extdiff =

[extdiff]
cmd.bc3 = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bc3 = /ro

I had to add the following to make it work on my machine:

[extensions]
extdiff =

[extdiff]
cmd.bc3 = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bc3 = /ro
别忘他 2024-07-16 08:30:54

如果您不断收到来自 BC 的“文件夹不可用”错误(我就是这样做的,当我同时打开多个 BC 实例时),请尝试将选项 /solo 添加到命令行,即:

[extdiff]
cmd.bcomp = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bcomp = /leftreadonly /solo

Source: < a href="http://www.scootersoftware.com/vbulletin/showthread.php?t=5093&highlight=mercurial" rel="nofollow noreferrer">踏板车软件支持论坛

If you keep getting this "Folder Not Available" error from BC (I did, when I had several instances of BC open simultaneously), try adding option /solo to the command line, i.e.:

[extdiff]
cmd.bcomp = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bcomp = /leftreadonly /solo

Source: Scooter Software support forum

无法回应 2024-07-16 08:30:54

从 Scooter Software 支持页面查看此页面 - 它还包括大多数设置版本控制系统 - 我的书签列表之一!

片段:

要配置 Mercurial,您需要编辑文件 %USERPROFILE%\Mercurial.ini 或 $HOME/.hgrc。 添加以下行,如果现有 INI 部分已存在,则使用它们:

Diff

[extensions] extdiff =

[extdiff] 
cmd.bcomp = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bcomp = /ro

[tortoisehg] vdiff = bcomp 

设置后,您可以使用

hg bcomp -r <rev1> [-r <rev2>] [<filename>]

3-Way Merge (v3 Pro)从命令行比较修订版本

[merge-tools] 
bcomp.executable = C:\Program Files\Beyond Compare 3\BComp 
bcomp.args = $local $other
$base $output bcomp.priority = 1
bcomp.premerge = True bcomp.gui = True

[ui] merge = bcomp

Checkout this page from the Scooter Software support page - it also includes settings for most version control systems - one for my bookmarks list!

Snippet:

To configure Mercurial you need to edit the file %USERPROFILE%\Mercurial.ini or $HOME/.hgrc. Add the following lines, using existing INI sections if they already exist:

Diff

[extensions] extdiff =

[extdiff] 
cmd.bcomp = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bcomp = /ro

[tortoisehg] vdiff = bcomp 

Once set up you can compare revisions from the command line using

hg bcomp -r <rev1> [-r <rev2>] [<filename>]

3-Way Merge (v3 Pro)

[merge-tools] 
bcomp.executable = C:\Program Files\Beyond Compare 3\BComp 
bcomp.args = $local $other
$base $output bcomp.priority = 1
bcomp.premerge = True bcomp.gui = True

[ui] merge = bcomp
汹涌人海 2024-07-16 08:30:54

我尝试了当时给出的建议,但没有奏效。

我发现了以下工作:

  1. 将 Beyond Compare 安装目录添加到您的系统 path
  2. 打开全局设置并将 diff 工具设置为 bcompare

现在尝试比较 - Beyond Compare!

I tried the suggestions given at the time but none worked.

I found the following works:

  1. Add beyond compare install directory to the yor system path
  2. Open the global settings and set the diff tools to bcompare

Now try a diff - Beyond Compare!

伪装你 2024-07-16 08:30:54

到目前为止给出的所有答案都是针对 Windows 的。 这是我针对使用 Linux 的用户的配置。

Diff

[extensions]
extdiff =

[extdiff]
cmd.bcomp = bcompare
opts.bcomp = -ro1

4-Way Merge (v3 Pro)

[merge-tools]
bcomp.executable = bcompare
bcomp.args = -title1='First Parent' -title2='Second Parent' -title3='Common Ancestor' -title4='Output' -ro1 -ro2 -ro3 $local $other $base $output
bcomp.premerge = True
bcomp.gui = True

-ro#:禁用指定一侧的编辑

-title#=</code>:在路径编辑中显示描述而不是文件名

< code># 字符:1=左、2=右、3=居中、4=输出

要了解 bcompare 的更多选项,只需执行 bcompare -help安慰。

All the answers given so far are for Windows. Here is my configuration for those using Linux.

Diff

[extensions]
extdiff =

[extdiff]
cmd.bcomp = bcompare
opts.bcomp = -ro1

4-Way Merge (v3 Pro)

[merge-tools]
bcomp.executable = bcompare
bcomp.args = -title1='First Parent' -title2='Second Parent' -title3='Common Ancestor' -title4='Output' -ro1 -ro2 -ro3 $local $other $base $output
bcomp.premerge = True
bcomp.gui = True

-ro#: Disables editing on specified side

-title#=<title>: Shows description instead of filename in path edit

# character: 1=Left, 2=Right, 3=Center, 4=Output

For more options of bcompare, simply execute bcompare -help in console.

夜唯美灬不弃 2024-07-16 08:30:54

如果您在正确解析配置时遇到问题,请注意任何变量或节名称的任何空格都会导致配置无法正确解析。 我不断复制和粘贴不同的配置并继续出现错误。 结果只是在许多变量之前添加了空格,导致它无法解析。

If you are having trouble getting your configuration to parse correctly please note that any space for any variable or section name will cause the configuration to parse incorrectly. I kept copying and pasting different configures and continued to get errors. It just ended up that spaces were added before many of the variables and it caused it not to parse.

日久见人心 2024-07-16 08:30:54

如果您使用TortoiseHg,您可以通过选择“文件”->“合并工具”将合并工具设置为“Beyond Compare”。 设置,然后在 TortoiseHg 选项上,选择 Visual Diff Tool 和 Three-way Merge Tool。 此设置也会影响通过命令行设置的合并。

If you are using TortoiseHg, you can set the merge tool to Beyond Compare by choosing File -> Settings, and then on the TortoiseHg choice, select Visual Diff Tool and Three-way Merge Tool. This setting affects merges which are set through the command line as well.

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