Linux 无法使用 meld svn diff

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11114586/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:57:52  来源:igfitidea点击:

Unable to svn diff using meld

linuxsvnmeld

提问by aash

I want to use meld to view the difference between revisions. I installed meld and then executed in the project directory:

我想使用 meld 查看修订版之间的差异。我安装了meld,然后在项目目录下执行:

svn diff -r 2165:2182 --diff-cmd meld

but it thows up the following error:

但它出现了以下错误:

Index: app/models/college_friends_count.rb
===================================================================
svn: E200012: Process 'meld' failed (exitwhy 2)

Can anybody tell me what is going wrong here?

谁能告诉我这里出了什么问题?

回答by Greg

I believe E200012 means the underlying process (meld) exited with a non-zero exit code. Lots of diff tools do this to indicate the result of the diff operation (0 = no difference 1 = differences, etc).

我相信 E200012 意味着底层进程(meld)以非零退出代码退出。许多差异工具这样做是为了指示差异操作的结果(0 = 无差异 1 = 差异等)。

Though my version of meld doesn't appear to use non-zero exit codes, I know colordiff does, which halts SVN during a directory-crawling "svn diff", like in your example above. Try it on a file that doesn't have any changes to test.

尽管我的 meld 版本似乎没有使用非零退出代码,但我知道 colordiff 确实如此,这会在目录爬行“svn diff”期间停止 SVN,就像上面的示例一样。在没有任何更改要测试的文件上尝试一下。

A good fix is to to make your own diff command, let's say you call it meld_svn:

一个好的解决方法是创建自己的 diff 命令,假设您将其称为 meld_svn:

#!/bin/bash
meld "" "" 
exit 0

So what we're doing is ignoring meld's exit codes, and exiting with our own (which won't stop SVN). The quotes around the arguments mean that filenames with spaces in them won't break your script.

所以我们正在做的是忽略 meld 的退出代码,并使用我们自己的退出代码(这不会阻止 SVN)。参数周围的引号意味着其中包含空格的文件名不会破坏您的脚本。

Make it executable, then edit your ~/.subversion/config and set the diff-cmd to "meld_svn". This works great for colordiff, should fix your problem with meld if meld's indeed exiting with non-zero exit codes.

使其可执行,然后编辑您的 ~/.subversion/config 并将 diff-cmd 设置为“meld_svn”。这对 colordiff 很有用,如果 meld 确实以非零退出代码退出,应该可以解决 meld 问题。

I hope that helps.

我希望这有帮助。

回答by Ben Page

For me the problem was that by default svn passes -u as an option to the external diff command, and meld doesn't expect or that flag.

对我来说,问题是默认情况下 svn 将 -u 作为选项传递给外部 diff 命令,而 meld 不期望或该标志。

The -xflag for svn-diffallows you to to override this default flag:

-x为标志svn-diff,您可以覆盖此默认标志:

 svn diff -x \"\" --diff-cmd meld

This replaces -uwith ""on melds command line, the escapes are required so that your shell doesn't parse the quote-marks the first time round and instead passes them to SVN, who passes it onto the meld command line.

这取代-u""在 melds 命令行上,转义是必需的,这样您的 shell 就不会在第一次解析引号,而是将它们传递给 SVN,后者将其传递到 meld 命令行。

(btw, using echoas the diff-cmd allows you to easily inspect what SVN would send to meld)

(顺便说一句,使用echodiff-cmd 可以让您轻松检查 SVN 将发送给 meld 的内容)