Unable to svn diff using meld

耗尽温柔 提交于 2020-01-03 10:22:08

问题


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?


回答1:


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.




回答2:


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)



来源:https://stackoverflow.com/questions/11114586/unable-to-svn-diff-using-meld

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!