开发者

howto make svn diff look like diff?

开发者 https://www.devze.com 2022-12-25 07:33 出处:网络
There\'s another question: howto make diff look like svn diff? but I want the exact opposite. I\'m trying to get svn diff to display with < and >

There's another question: howto make diff look like svn diff? but I want the exact opposite. I'm trying to get svn diff to display with < and >

The obvious answer would be:

svn diff --diff-cmd /usr/bin/diff  file

but when I do that I get

/usr/bin/diff: illegal option -- L

So I do this

svn diff --diff-cm开发者_运维技巧d /usr/bin/echo  file

to see what's going on. and it spits out all this, which I can see why diff doesn't like it....

-u -L file (revision 11371) -L file   (working copy) .svn/text-base/file.svn-base file

So... how do I make svn actually use another program for diffing?


You seem to have a version of diff installed on your system that is too old or incompatible with how svn wants to call it. In my system, the -L option is defined thusly:

   -L label
   --label=label
          Use label instead of the file name in the context format and unified format headers.

So you should just use a diff command that removes that flag before passing it along to your system's diff. I do something similar to add a custom set of options to diff (and add colours), in my .subversion/configs file:

diff-cmd=/home/ether/bin/svndiff-w

...where the program is just a simple shell script:

#!/bin/bash
diff=/usr/bin/colordiff
args="-u -wi -U 6 --new-file"    
exec ${diff} ${args} "$@"

This is discussed in more detail in the manual under Using External Differencing and Merge Tools.


I get the same error with the --diff-cmd option, this is how I could force correct usage of my /usr/bin/diff:

svn cat $FILE --revision COMMITTED | diff $FILE -
0

精彩评论

暂无评论...
验证码 换一张
取 消