Unable to svn diff using meld

2019-06-22 13:12发布

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

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?

标签: linux svn meld
2条回答
爷的心禁止访问
2楼-- · 2019-06-22 13:33

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).

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.

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

#!/bin/bash
meld "$6" "$7" 
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.

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.

I hope that helps.

查看更多
Summer. ? 凉城
3楼-- · 2019-06-22 13:44

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.

The -x flag for svn-diff allows you to to override this default flag:

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

This replaces -u with "" 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.

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

查看更多
登录 后发表回答