tags:

views:

233

answers:

3

How would I get a full copy of an SVN repository and import it on another server?

+5  A: 

You want to perform an svnadmin dump. You can get help on this command via svnadmin help dump or reading the docs. You can then load the dump file into your new server using svnadmin load.

rmeador
A: 

It depends on the repository type. If you're using fsfs, you can just copy the directory after stopping the server (to make sure you don't copy a transaction which is half completed). I've done that before and it worked flawlessly.

If you're using bdb you should do an svnadmin dump instead. (If the old and new computers are similar in terms of architecture and OS you may well just get away with a directory copy, but dumping the repository would be safer.)

Jon Skeet
if you just copy the directory using the OS file copy command, you run the risk of corruption. You can use "svnadmin hotcopy" to perform a copy as you describe without the risk of corruption. The dump/load cycle is usually preferred however, as it allows for loading into a different version of SVN
rmeador
Would probably work, though I would probably be worried about it for days. svnadmin dump seems like a more reliable solution.
Andrei Serdeliuc
@rmeador: Assuming you stop the server first (which I'll edit my answer to mention) why do you risk corruption? What could go wrong?
Jon Skeet
If the repo isn't in use, I think you're safe. Using "svnadmin hotcopy" is just The Right Way according to the SVN developers, especially if the repo is in use.
rmeador
+1  A: 

If you don't have access to the physical server (and the server runs Subversion 1.4 or later) you could use svnsync to create a local copy of the complete repository.

After that you can use svnadmin to create a dumpfile from your local copy.

See also How do I create a dump file from my subversion hosting account?

Bert Huijben