Shell导出SVN上两个给定的节点间修改的文件

在SVN工程的根目录下执行

#!/bin/sh

#功能:导出SVN上两个给定的节点间修改的文件,输出到指定的目录中
#示例:sh svn_export_diff.sh rev1 rev2 outFolder

#获取SVN服务器地址
url=`svn info|awk -F ': ' '{if($1 == "URL"){print $2}}'`
#结尾添加斜杠/
SVN_ROOT=$url"/"
echo $SVN_ROOT

if [ $# -eq 3 ];then
svn diff --summarize -r $1:$2|awk '{print $2}' > $3/temp.txt
cat $3/temp.txt | while read line
do
mkdir -p $3/$line
rm -r $3/$line
svn export -r $2 $SVN_ROOT$line $3/$line
done
else
echo "./$0 rev1 rev2 outFoler"
fi

This entry was posted in Shell.