自动创建SVN branch 并把online code 和trunk code 进行对比

今天收到个需求,不做评论,我只呵呵,废话不多说,看script

#!/bin/bash
i=$(svn list svn://*.*.*.*:9361/projectname | tail -2 | head -1 | cut -c8)
i=$[$i+1]
branch='branchname4.9.'$i

svn mkdir svn://*.*.*.*:9361/projectname/$branch  -m “mkdir”
#svn copy svn://*.*.*.*:9361/projectname/trunk svn://*.*.*.*:9361/projectname/$branch -m "make a $branch" 
echo $branch
mkdir -p /home/svncomparetrunk/application
svn checkout svn://*.*.*.*:9361/projectname/trunk/path/to/application /home/svncomparetrunk/application

find /home/svncomparetrunk -type d -name ".svn" | xargs rm -rf

svn import /home/svncomparetrunk svn://*.*.*.*:9361/projectname/$branch -m "Initial import"
printf "[projectname:/%s] \n" "$branch" >> /home/svn/projectname/conf/authz
echo '@program = rw' >> /home/svn/projectname/conf/authz
echo '@admin = rw' >> /home/svn/projectname/conf/authz
date=`date +'%Y%m%d%H%M'`
DIR_A=$(find /home/svncomparetrunk -type f)
DIR_B=$(find /home/svncompareonline -type f)
compare ()
{

for i in $1
       do
          diff $i $2 > /script/svn/difftrunk$date.log
       if [$? -eq 0 ];then
               echo "$i and $2 are the same
               else
               echo "what the fuck!!!"
       fi
done   

}


for i in $DIR_B
       do 
       compare $DIR_A $i
done
rm -rf /home/svncomparetrunk/*


你可能感兴趣的:(SVN,checkout,online)