To move a subversion repository just dump the repository.
Here is a little script to dump all /var/svn repositories to their own portable dump.gz file:
#!/usr/bin/perl
## backup each repository in /var/svn to a file dirname.svn.dmp.gz
## and push to repository$single = shift;
$DIR = “/var/svn”;
opendir(DH,”/var/svn”);while ( $repo = readdir(DH) ) {
next if $repo =~ /\./g;
next unless $repo =~ /$single/;
$cmd = “svnadmin dump $DIR/$repo | gzip -c > /repository/tcg_backup/$repo.dmp.gz”;
print “\n$cmd”;system($cmd);
}
Create new repository on new site
$DIR=”/var/svn”;
$TMP=”/tmp”;chdir($DIR);
$single = shift;
foreach $repo (@repos) {
next unless $repo =~ /$single/;
print “\npulling $repo”;
$repo =~ /^(.*)\.dmp\.gz/;
$name = $1;# remove old dump file
unlink(“$TMP/$repo”);# remove any old repository directory
$cmd = “rm -rf /var/svn/$name”;
print “\n$cmd”;
system($cmd);$cmd = “cd $TMP; wget –no-check-certificate https://10.5.20.103/repository_pull/tcg_backup/$repo”;
print “\n$cmd”;
system($cmd);die “Could not get file from repository” unless -s “$TMP/$repo”;
$cmd = “cd /var/svn; svnadmin create $name”;
print “\n$cmd”;
system($cmd);$cmd = “cd /var/svn; gunzip < $TMP/$repo | svnadmin load $name"; print "\n$cmd"; system($cmd); } $cmd = "chown -R apache:apache /var/svn"; print "\n$cmd"; system($cmd);
SWITCH your existing working copies to point to the new machine with this nifty little svn switch command:
svn switch –relocate https://10.5.20.103/svn/cobra/trunk https://svn_repo.colum
biagroup.com/svn/cobra/trunk