标题:使用vim来查看svn diff的内容 出处:Felix021 时间:Tue, 03 Aug 2010 20:53:58 +0000 作者:felix021 地址:https://www.felix021.com/blog/read.php?1901 内容: svn的diff很好用,但是还不够好用,因为不像vim,可以很直观地看到两个文件的区别。Google了一下,发现一个还不错的解决方案( http://erik.thauvin.net/blog/news.jsp?date=2006-02-14 ),代码在这里: http://vc.thauvin.net/svn/linux/svndiff/svndiff.sh?view=markup ,但是有点小BUG。我FIX了一下,然后增加了一个小feature,允许在命令行后面跟上 "-r REV" 来指定与最新版本比较的版本号。代码如下: #!/bin/sh # svndiff -- svn diff with vimdiff. # # Written by Erik C. Thauvin (erik@thauvin.net) # May 11, 2006 # # Copyright (C) 2006 Erik C. Thauvin. All rights reserved. # # This software is provided "as is" without express or implied warranties. # # Permission is granted to use, copy, modify and distribute this software, # provided this disclaimer and copyright are preserved on all copies. This # software may not, however, be sold or distributed for profit, or included # with other software which is sold or distributed for profit, without the # permission of the author. # # $Id$ # # Modified by felix021 (felix021@gmail.com) # Aug 3, 2010 PROGNAME=`basename $0` if [ $# -lt 1 ]; then echo "Usage: $PROGNAME [-r REV]" exit; fi filename=$1 pid=$$ TEMP=/tmp/tmp.$pid.$filename pv= if [ $# -gt 3 -a $2 = "-r" ]; then pv="-r $3" fi svn cat $filename $pv > $TEMP vimdiff $TEMP $filename rm -f $TEMP @p.s. 2010.8.4 昨天给Erik发了封邮件,今天发现他已经把我的修改更新进去了:D Generated by Bo-blog 2.1.0