Friday, February 22, 2013

Nice little script to recursively export from SVN selected projects

I want to export only projects which have the "trunk" folder inside:

svnusername=thesvnuser
svnpassword=thesvnpassword

repositoryLocation=https://yoursvnserver/yourroots

svn --username ${svnusername} --password ${svnpassword} list ${repositoryLocation} | sed 's,/,,g' > projects.txt

while read line ;
do
 svn --username ${svnusername} --password ${svnpassword} list ${repositoryLocation}/${line}/trunk 2>&1 > /dev/null
    echo "processing ${line}"
 if [ $? -gt 0 ]; then
  echo "project " ${line} " has no trunk"
 else
  svn --username ${svnusername} --password ${svnpassword} export ${repositoryLocation}/${line}/trunk allprojects/${line}
 fi
done < projects.txt



No comments: