How to move an SVN repository to a new server

49,252

Solution 1

You can migrate a repository using the svnadmin dump function. On the SVN server, type svnadmin dump /absolute/path/to/the/repo > /tmp/repo.svndump. This will export the entire repository to a text file in the system's temporary directory and name it "repo.svndump". You might want to compress that file before transferring it to the new server.

Once you have the repo exported, you can then transfer the dump file to the new server and import it like so: svnadmin load /absolute/path/to/the/**new**/repo < repo.svndump.

See 'svnadmin dump' and 'svnadmin load' for more information.

After dumping the repository and loading it on the new server you would use the --relocate command to switch your local copy to the new server.

Caution: If your repositories use any externals then you will have some problems. See my question on Server Fault for details about this.

Solution 2

If the new server uses the same operating system you can just copy the entire repository folder to the new server. No need to dump and reload it.

The relocate command allows you to point your working copy to the new server i.e. it does not help you to move the repository, it just saves you from doing a fresh checkout.

Externals can be a problem but do not have to be. If the external repository was on the same server then you probably specified the external with a relative URL. If the new server uses the same structure then everything should work just fine.

Solution 3

CLONE-SVN2SVN

If svnadmin dump is not an option, you can use the clone-svn2svn bash script. It copies an SVN directory to another SVN site with compete or partial revision history. Below are the main command line parameters. You can also set the revision from which you want the clone to start copying the history.

clone-svn2svn.sh <source-svn-url> <destination-svn-url>

Requirements

Bash and git are required for the script to work. If you are on Windows or another platform, download them from git-scm web site. This is a git installer with bash included.

Details

The script downloads the source SVN history to a temporary git repository by using git-svn and uploads the history to the target SVN repo.

Shortcomings

The author in revisions in the target repo will be the user running the script (yourself). However, each revision message will have an additional line specifying the original author. So it's not too bad.

Share:
49,252
Joe Phillips
Author by

Joe Phillips

Whatever you do, do it well. I perpetually consider myself a student; there is always more to learn or a new perspective to be seen I believe proper design starts with understanding principles and applying them to your needs I enjoy reading tech books to gain an understanding of a topic and orient myself in the ecosystem I believe bold claims require evidence/proof

Updated on July 05, 2022

Comments

  • Joe Phillips
    Joe Phillips almost 2 years

    We would like to merge two of our servers together and in order to do that we would need to install SVN on the "new" server and then move over all of our repositories that we have set up on our "old" server.

    Is this an easy operation to do? Possibly using the "Relocate" option that TortoiseSVN provides? What is the best way to do it?

    Would this be a good time to re-organize how the repository is set up as well?

  • Joe Phillips
    Joe Phillips over 13 years
    The repo currently does not have the branch/trunk/tag structure
  • Arafangion
    Arafangion over 13 years
    If you use the Berkeley database backend, which used to be the default, then you absolutely MUST do the dump-and-restore appraoch, because otherwise the pain just isn't worth it.
  • ryvantage
    ryvantage almost 11 years
    I did this, but now I get an error svn: E175002: Commit failed (details follow): svn: E175002: PROPFIND of '/Project/Project/src/dashboards/BasicLineGraph.java': 500 Internal Server Error (http://www.domain.com) trying to figure this one out.. I reinstalled it several times, no dice.
  • Appulus
    Appulus about 10 years
    It's probably a no-brainer for most people, but I had to create the new repo first before I could load the dump successfully.
  • Jonny
    Jonny about 8 years
    @Appulus that had better be added to the answer, IMO
  • Jonny
    Jonny about 8 years
    branch/trunk/tag is just a logical organisation style within the subversion world itself. It does not have anything to do with the repo location and would be better off done before or after migration.