This one could obviously use some cleaning up and revision, but it’s a pretty effective script for moving from an older SVN to a newer one.
Note that it relies on my previously posted script for creating repositories, a text file of repositories that you want moved, and a and svnrdump, a new feature for Subversion that allows you to remotely dump a repo via HTTPS.
This script checks local and remote versions, dumps 1000 revisions to a .dmp file, commits that, and moves on to the next repo. It could easily be modified to run in a loop.
#!/bin/bash -l
cd [SVN script location]
logfile=./update_good_repos.log
repolist=$(cat ./good_repos.txt)
echo "About to update the following repos:"
echo $repolist
echo "This could take a VERY long time."
#echo "Press any key to continue..."
#read -n1 any_key0
for repo in $repolist
do
localversion=$(svn info [local SVN]/$repo --trust-server-cert --username [username] --password [password] --non-interactive | sed -n 's/^Last Changed Rev: //p')
if [ -z $localversion ]
then
# echo "localversion is null"
./create_repository.sh $repo
localversion=0
fi
localversion=$(svn info [local SVN]/$repo --trust-server-cert --username [username] --password [password] --non-interactive | sed -n 's/^Last Changed Rev: //p')
remoteversion=$(svn info [remote SVN]/$repo --trust-server-cert --username [username] --password [password] --non-interactive | sed -n 's/^Last Changed Rev: //p')
increment=$(($localversion+1000))
if [ $increment -gt $remoteversion ]
then
increment=$remoteversion
fi
echo -e "$repo\t\tLocal:$localversion\t\tRemote:$remoteversion"
if [ $localversion -lt $remoteversion ]
then
echo -e "Dumping versions $(($localversion+1)) through $increment of repo $repo to [SVN dump location]/$repo/$(($localversion+1))-$increment.dmp"
mkdir -p /[SVN dump location]/$repo
/usr/local/bin/svnrdump dump --trust-server-cert --username [username] --password [password] --non-interactive --incremental -r $(($localversion+1)):$increment [Remote SVN]/$repo > [SVN dump location]/$repo/$(($localversion+1))-$increment.dmp
/usr/local/bin/svnadmin load [local SVN]/$repo < [SVN dump location]/$repo/$(($localversion+1))-$increment.dmp
fi
done
Posted by alexthegraham 