如何配置Mercurial使用WinMerge进行合并,在cygwin下? [英] How can I configure Mercurial to use WinMerge for merges, under cygwin?

查看:223
本文介绍了如何配置Mercurial使用WinMerge进行合并,在cygwin下?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Mercurial在cygwin下运行时,弄清楚如何生成 WinMerge 来解决合并冲突有点棘手。如何做到这一点?

When Mercurial is running under cygwin, it's a bit tricky to figure out how to spawn WinMerge to resolve merge conflicts. How can I do this?

推荐答案

诀窍是cygwin路径与Windows路径不一样,脚本将cygwin路径转换为Windows路径,然后将它们作为参数传递给WinMerge。

The trick is that cygwin paths are not the same as Windows paths, so you need a little script that converts the cygwin paths to Windows paths before passing them as arguments to WinMerge.

这是如何做的:

(1)在 / usr / bin / winmerge 中创建一个shell脚本,如下所示:

(1) Create a shell script in /usr/bin/winmerge as follows:

#!/bin/sh
"/cygdrive/c/Program Files/WinMerge/WinMergeU.EXE" /e /ub /dl other /dr local `cygpath -aw $1` `cygpath -aw $2` `cygpath -aw $3`

注意: cygpath 转换路径名。如果WinMerge不在默认位置,请更改此处的路径。

Note: cygpath converts path names. If WinMerge isn't in the default location, change the path here.

(2)使该文件可执行

 chmod +x /usr/bin/winmerge

3)在〜/ .hgrc 文件中添加以下内容:

(3) Add the following to your ~/.hgrc file:

[ui]
merge = winmerge

[merge-tools]
winmergeu.executable=/usr/bin/winmerge
winmergeu.args=$other $local $output
winmergeu.fixeol=True
winmergeu.checkchanged=True
winmergeu.gui=False

注意!你可能已经有一个带有你的名字的[ui]部分。请记住将我的更改与您的更改合并,不要只添加一个新的[ui]部分。例如,我的.hgrc看起来像这样:

Note! You probably already have a [ui] section with your name in it. Remember to merge my changes with yours, don't just add a new [ui] section. For example, my .hgrc looks like this:

[ui]
username = Joel Spolsky <spolsky@example.com>
merge = winmergeu

[extensions]
fetch =

[merge-tools]
winmergeu.executable=/usr/bin/winmerge
winmergeu.args=$other $local $output
winmergeu.fixeol=True
winmergeu.checkchanged=True
winmergeu.gui=False

这篇关于如何配置Mercurial使用WinMerge进行合并,在cygwin下?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆