如何让 Subversion 使用第三方 diff 工具?

发布于 2024-07-08 23:21:37 字数 113 浏览 7 评论 0原文

我需要的不仅仅是默认的差异! 我最近购买了“Beyond Compare”,我想将它与 svn 集成,因此当我输入:

svn diff foo.c

时它就会启动我该如何操作?

I need more than the default diff! I have recently purchased "Beyond Compare" and I'd like to integrate it with svn, so its launched when I type:

svn diff foo.c

How do I do this?

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

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

发布评论

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

评论(5

鹿童谣 2024-07-15 23:21:37

来自 Beyond Compare 论坛帖子

#!/bin/bash
/usr/bin/bcompare $6 $7 &
exit 0

/usr/bin/ bcompare_svn bcompare 的调用是显而易见的,但我必须添加“exit 0”,以便 svn 一次打开多个文件。

为了使 svn 调用我的脚本,我在 ~/.subversion/config 的 [helpers] 部分添加了以下行

diff-cmd=/usr/bin/bcompare_svn

From a Beyond Compare forum post:

/usr/bin/bcompare_svn:

#!/bin/bash
/usr/bin/bcompare $6 $7 &
exit 0

The invocation of bcompare is obvious but I had to add "exit 0" so that svn would open more than one file at a time.

To make svn invoke my script, I added the following line in the [helpers] section in ~/.subversion/config

diff-cmd=/usr/bin/bcompare_svn
故人如初 2024-07-15 23:21:37

查看 svn --diff-cmd。

Look at svn --diff-cmd.

枫林﹌晚霞¤ 2024-07-15 23:21:37

我想对安迪·莱斯特的回答添加评论,但我没有足够大的声誉。 不过,我想我可以回答这个问题。

无论如何...正如安迪已经指出的那样,运行“svn help diff”,但只是为了给你答案...

svn diff --diff-cmd; --extensions;

svn diff --diff-cmd /usr/bin/diff --extensions "-bca" <文件名>;

I'd like to add a comment to Andy Lester's answer but I don't have a big enough reputation. However, I can answer the question, I guess.

Anyways... as Andy already noted run "svn help diff" but to just give you the answer...

svn diff --diff-cmd <diff-cmd> --extensions <diff-cmd options>

svn diff --diff-cmd /usr/bin/diff --extensions "-bca" <filename(s)>

韵柒 2024-07-15 23:21:37

I recently added instructions for Subversion on Linux to our Using Beyond Compare With Version Control Systems web page. Once you follow the steps at the above link it should launch Beyond Compare 3 for Linux when you run "svn diff".

落花浅忆 2024-07-15 23:21:37

在最新的 Subversion 中,脚本 /usr/bin/bcompare_svn 应该是这样的:

#!/bin/bash
cp $6 $6.save
cp $7 $7.save
{
    /usr/bin/bcompare $6.save $7.save 
    rm $6.save $7.save
} &
exit 0

或者(未经测试的代码)

#!/bin/bash
base=`echo $3 | sed -r "s/^([^\(]+)[ \t]+\((.+)\)$/\1.\2/g" | xargs -i% basename "%"`
current=`echo $5 | sed -r "s/^([^\(]+)[ \t]\((.+)\)$/\1.\2/g" | xargs -i% basename "%"`

mv "$6" "/tmp/$base"
mv "$7" "/tmp/$current"
{
    /usr/local/bcompare/bin/bcompare "/tmp/$base" "/tmp/$current"
    rm "/tmp/$base" "/tmp/$current"
} &
exit 0

In latest Subversion, the script /usr/bin/bcompare_svn should be like this:

#!/bin/bash
cp $6 $6.save
cp $7 $7.save
{
    /usr/bin/bcompare $6.save $7.save 
    rm $6.save $7.save
} &
exit 0

or (untested code)

#!/bin/bash
base=`echo $3 | sed -r "s/^([^\(]+)[ \t]+\((.+)\)$/\1.\2/g" | xargs -i% basename "%"`
current=`echo $5 | sed -r "s/^([^\(]+)[ \t]\((.+)\)$/\1.\2/g" | xargs -i% basename "%"`

mv "$6" "/tmp/$base"
mv "$7" "/tmp/$current"
{
    /usr/local/bcompare/bin/bcompare "/tmp/$base" "/tmp/$current"
    rm "/tmp/$base" "/tmp/$current"
} &
exit 0
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文