如何将 kdiff3 设置为 SVN 的合并工具
当 SVN 通知我有关冲突时,我希望能够使用 kdiff3 解决冲突。我如何将其设置为默认工具?
I would like to be able to resolve conflicts using kdiff3, when SVN notifies me about the conflict. How can I set it as a default tool for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
转到 Subversion 配置文件(
/etc/subversion/config
或~/.subversion/config
),然后设置merge-tool-cmd
变量与你最喜欢的工具:虽然kdiff3有一个问题,它不支持四个普通参数(SVN将四个普通参数传递给kdiff3,它不起作用),所以通常用一个简单的脚本来调用它来翻译参数,例如,“kdiff3caller”:
这个 kdiff3 问题和解决方案的解释 这里。
Go to the Subversion configuration file (
/etc/subversion/config
or~/.subversion/config
), and setmerge-tool-cmd
variable with your favourite tool:Although there is a problem with kdiff3 which does not support four plain arguments (SVN passes four plain arguments to kdiff3, and it does not work), so it is usually called with a simple script to translate the arguments, e.g., "kdiff3caller":
This kdiff3 problem and solution is explained here.
我在某个我不记得的地方找到了这个脚本。但作者是迈克尔·布拉德利。
我的答案与 Jon Ander Ortiz Durántez 的答案类似。因此,如果他的答案不起作用,你还有备用方案。我曾经尝试过像他建议的那样,但它总是输出一些参数错误,直到我发现这个脚本解决了所有问题。
创建一个脚本文件并在
~/.subversion/config
中设置diff-cmd = /path/to/script.sh
I found this script somewhere I can't remember. but the author is Michael Bradley.
My answer is similar to Jon Ander Ortiz Durántez's answers. So if his answer doesn't work, you have a backup. I once tried something like he suggested, but it always output some error with the parameters until I found this scripts which resolved everything.
Create a script file and set
diff-cmd = /path/to/script.sh
in your~/.subversion/config
一个更短并且适用于更高版本的 SVN 的解决方案(在 SVN 1.7.7 上测试):
创建一个脚本 ~/svn-merge-kdiff
将其绑定到 ~/.subversion 中的 svn /配置
A solution that is shorter and works with later versions of SVN (tested on SVN 1.7.7):
Create a script ~/svn-merge-kdiff
Bind it to svn in ~/.subversion/config
yvoyer 的答案中的脚本对我来说非常有用,我正在使用 SVN 1.4。我认为 Jon Ander Ortiz Durántez 之前的回答适用于 SVN 1.5 及更高版本,并且此脚本适用于 1.5 之前的 SVN 版本。看来 --diff-cmd & 发生了变化--diff3-cmd 适用于版本 1.5。比较以下 2 个 SVN 文档中的脚本以查看一些差异:
&
Michael Bradley 的脚本非常有用,因为现在如果我在
svn update
期间遇到冲突,它会启动 kdiff3,而不是用“>>”在整个文件中吐槽。 ;>”如果您有复杂的冲突,则很难解决冲突标记。 diff3-cmd 适用于合并和更新。我将
diff3-cmd = /usr/local/bin/svndiff3
添加到~/.subversion/config
(或使用--diff3-cmd
因为我编写了自己的脚本来将 svn diff 发送到 sdiff 并由--diff-cmd 指定。
此脚本发布于 yolinux,这里发布了一个稍微修改过的版本(处理自动合并)Jawspeak。
The script from yvoyer's answer works great for me, and I am using SVN 1.4. I think the previous answer from Jon Ander Ortiz Durántez works for SVN 1.5 and greater, and this script works for SVN versions prior to 1.5. It appears there were changes to --diff-cmd & --diff3-cmd for version 1.5. Compare scripts in the following 2 SVN docs to see some differences:
&
Michael Bradley's script is really useful since now if I get a conflict during
svn update
it kicks into kdiff3 instead of barfing all over the file with the ">>>>>>>>" conflict markers which are so difficult to resolve if you have complex conficts. The diff3-cmd works for both merge and update.I add
diff3-cmd = /usr/local/bin/svndiff3
to~/.subversion/config
(or use--diff3-cmd
on the cmdline) since I wrote my own script to sendsvn diff
to sdiff and is specified by--diff-cmd
.This script is posted at yolinux, and a slightly modified version (that handles auto-merging) is posted here Jawspeak.