Вы находитесь на странице: 1из 5

moving/migrating svn repositories

http://www.mrkirkland.com/movingmigrating-svn-repositories/

Skip to content Follow: RSS Twitter Mr Kirkland Your all singing and breakdancing CEO Home About Contact

by Mr Kirkland on November 2nd, 2010 For those of you still on SVN (and so I dont forget) heres a few SVN tips for when moving repositories

If the repo moves, to a new server or changes protocal (ssh -> https) etc. Then theres a simple command for seamlessly updating your local checked out copy
svn switch --relocate

To figure out what should be look in the .svn/entries file in the top dir of your local copy. Youll see something like (for svn+ssh)
svn+ssh://username@svnserver.com/var/lib/svn/project_name/trunk svn+ssh://username@svnserver.com/var/lib/svn/project_name

so if you are moving to new-svnserver.com then youd use:


svn switch --relocate svn+ssh://username@svnserver.com/var/lib/svn/project_name/trunk svn+ssh://username@new-svnserver.com/var/lib/svn/project_name/trunk

or perhaps youre moving to a hostedservice.com and accessing over https:


svn switch --relocate svn+ssh://username@svnserver.com/var/lib/svn/project_name/trunk https://hostedservice.com/myaccount/project_name/trunk

If you happen to have a number of projects in the same dir all needing the same migration, heres a quick shell script to loop through them all:
#some config DATA_PATH=/path/to/projects

1 of 5

1/24/2012 12:33 AM

moving/migrating svn repositories

http://www.mrkirkland.com/movingmigrating-svn-repositories/

OLD_SERVER=svn+ssh://username@oldeserver/var/lib/svn/ NEW_SERVER=https://hostedrepo.com/accoutname/ cd $DATA_PATH for i in * do if [ -f $DATA_PATH/$i/.svn/entries ] then cd $DATA_PATH/$i && line=$(grep -m1 $OLD_SERVER .svn/entries); new_line=$(echo "$line" | sed "s|$OLD_SERVER|$NEW_SERVER|g") svn switch --relocate $line $new_line; fi cd $DATA_PATH done

Its pretty simple to migrate repositories with the command


svn dump

1. On the old server, dump all the individual projects in /var/lib/svn (or wherever your repository is located)
cd /var/lib/svn for i in *;do echo $i; svnadmin dump $i > /path/to/dump/$i.dump;done scp /path/to/dump/*.dump newserver:/tmp/

2. assuming you have already installed svn on the new server with a svn user account (assumed to be svn below), load the dumped data:
#load the dumps we just copied accross cd /tmp/ for i in *.dump;do REPO=$(echo $i | sed s/.dump//g); svnadmin create /var/lib/svn/$REPO; svnadmin load /var/lib/svn/$REPO < $i;done #now set permissions cd /var/lib/svn/ for i in *;do echo $i; chown -R svn:svn $i; chmod -R g+w $i/db;done

3. The you'll probably want to follow the tip above about updating clients with the new server url references https://wiki.archlinux.org/index.php/Subversion_backup_and_restore http://svnbook.red-bean.com/en/1.1/ch05s03.html#svn-ch-5-sect-3.5

2 of 5

1/24/2012 12:33 AM

moving/migrating svn repositories

http://www.mrkirkland.com/movingmigrating-svn-repositories/

From Uncategorized No comments yet Leave a Reply


Name: (required): Email: (required): Website:

Comment:

Note: XHTML is allowed. Your email address will never be published. Subscribe to this comment feed via RSS

Increase Facebook Fans Case Study: Sponsored Story vs Advert moving/migrating svn repositories Preparing Your Website/Web App For Scalability Amazon s3 versioning Cloud Computing Price Comparison

3 of 5

1/24/2012 12:33 AM

moving/migrating svn repositories

http://www.mrkirkland.com/movingmigrating-svn-repositories/

So glad I found this EC2 image: http://ec2onrails.rubyforge.org/ saved me hours of time fighting trying to get debian/ruby to play nice. 2010-11-01 if you're running your own imap server and wanna use it on dem iphonez http://troy.yort.com /self-signed-imap-ssl-certs-on-iphone 2010-10-28 Blast and Damnation, I should know better. recent 50% traffic drop due to a single .htaccess rule. 2010-09-27 More updates...

I founded and am CEO of artweb.com I spend most my time in Tokyo, and way too much money on matcha latte To relax, I like kidnapping girls, going to the beach and kitesurfing and standing on my head I can sing and break dance, though not usually at the same time. more... also check out stronglook.

4 of 5

1/24/2012 12:33 AM

moving/migrating svn repositories

http://www.mrkirkland.com/movingmigrating-svn-repositories/

Copyright 2012 MrKirkland. Titan Theme by The Theme Foundry.

5 of 5

1/24/2012 12:33 AM

Вам также может понравиться