还原到某个版本

撤销修改

diff比较

查看log

svn使用vimdiff

git 里提到了git使用vimdiff替换默认的diff工具, svn也可以实现

首先可以写一个小脚本:

1
2
3
4
5
6
7
8
#!/bin/sh
# 配置你喜欢的diff程序路径
DIFF="vimdiff"
# SVN diff命令会传入两个文件的参数 
LEFT=${6}
RIGHT=${7}
# 拼接成diff命令所需要的命令格式
$DIFF $LEFT $RIGHT

可以把脚本放到/usr/bin/svndiff, 然后增加x权限

接着修改svn本地用户配置文件~/.subversion/config, 里面有这么一行:

# diff-cmd = diff_program (diff, gdiff, etc.)

改为

diff-cmd = /usr/bin/svndiff

然后就可以了

参考了:

diff: file marked as a binary type 问题

2013-07-25 补充:

今天在 svn diff 看一个 xml 文件时, 显示:

Index: assets-meishan.xml
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/xml

无法查看, 但是另外一个 xml 文件就可以 diff, 且用 file 命令查看, 都是 XML document text

google 了下, 找到了解决方法

方法一:

svn diff --force path/to/file

方法二:

You can use the Subversion property svn:mime-type to set an explicit mimetype on the file:

svn propset svn:mime-type 'text/plain' path/to/file

Alternatively, you can delete this property (since Subversion assumes plaintext, otherwise) using:

svn propdel svn:mime-type path/to/file

参考:

TODO : 当时是直接用方法一解决的, 抽时间研究下 svn:mine-type 的问题