How to move a Subversion repository to a different server location

Okay, so let’s say you host a subversion repository on one server and need to completely move or copy it to a different server or server location.  The Tigris guys make it very easy.  This information is explained in more detail in the free Subversion PDF titled “Version Control with Subversion 1.4″ starting on page 126.  I find it easier here.

# Run these commands from current Subversion repository server’s svn root directory

cd ~/rep/svn
svnlook youngest myproject1
# > 1234
# we want record of ALL revisions, so we need to specify from
# revision 1 to revision X, in this case 1:1234
svnadmin dump myproject1 -r 1:1234 > myproject1_dumpfile_r1-1234
# * Dumped revision 1.
# * Dumped revision 2.
# * …
# * Dumped revision 1234.

# Now you need to get this dumpfile over to your new server.
# I like to use secure copy “scp” to quickly download the file
# to my local machine, then immediately upload it to the new server.
# You, of course, can do this any way you like.
# Some people like to use a graphical FTP also (I like CyberDuck).

# on local machine: cd ~/

# download with “scp [from] [to]”
scp super@111.222.333.444:/home/super/rep/svn/myproject1_dumpfile_r1-1234 ~/work/projects/myproject1_dumpfile_r1-1234
# > myproject1_dumpfile_r1-1234 =====> 100%   10MB 336.1KB/s   00:31

# upload with “scp [from] [to]”
scp ~/work/projects/myproject1_dumpfile_r1-1234 super@111.222.333.444:/home/super/rep/svn/myproject1_dumpfile_r1-1234
# > myproject1_dumpfile_r1-1234 =====> 100%   10MB  81.4KB/s   02:08

# Now “load” the dump file onto your new Subversion server with these commands

cd ~/rep/svn
svnlook youngest myproject2
# …if new repo doesn’t exist already, you’ll see
# > No such file or directory
# …or if repo does exist, then revision number is displayed
# > 1211
svnadmin load myproject2 < myproject1_dumpfile_r1-1234
# you should see a lot of output, and at the end:
# > ——- Committed revision 1234 >>>

Done!
That was crazy easy!

Leave a Comment

You must be logged in to post a comment.