這幾天公司須要統計svn的相關數據,最後發現了statsvn這個工具能夠實現要求,因而就測試了下,感受還真的不錯,爲了能自動去生成一個庫的統計,我就本身寫了個超級簡單的腳本,你們別見笑!!!!!!!!!!!!
#!/bin/bash
echo "Please enter the name of a library"
read library
mkdir /usr/local/apache2/htdocs/$library
svn checkout svn://10.10.1.64:4002/$library /usr/local/apache2/htdocs/tongji/$library --username xxx --password xxx
if [ $? = 0 ]
then
svn log --xml -v --username xxx --password xxx /usr/local/apache2/htdocs/tongji/$library >/usr/local/apache2/htdocs/tongji/$library/svn.log
if [ $? = 0 ]
then
java -jar /usr/local/apache2/htdocs/statsvn-0.7.0/statsvn.jar /usr/local/apache2/htdocs/tongji/$library/svn.log /usr/local/apache2/htdocs/tongji/$library -output-dir /usr/local/apache2/htdocs/$library
rm -rf /usr/local/apache2/htdocs/tongji/$library
else
exit 0
fi
else
exit 0
fi