How do I migrate an SVN repository to another SVN repository?

Is there a simple way to copy a directory from one repository into another repository with copying all of the history?


The simplest way is using:

svnadmin dump path/to/repos > repos.out

This will create a portable format for your repository (with history) in the file repos.out. You can then use

svnadmin load path/to/newrepos < repos.out

to load your 'dumped' repository to the new or existing one.

Chapter 5. Repository Maintenance -> Migrating Repository Data Elsewhere has this note about using svnadmin dump as of version 1.7:

The Subversion repository dump format describes versioned repository changes only. It will not carry any information about uncommitted transactions, user locks on filesystem paths, repository or server configuration customizations (including hook scripts), and so on.


As suggested in the Subversion book:

svnadmin dump path/to/repos_src \
    | svndumpfilter include path/inside/svn/to/directory \
    | svnadmin load path/to/repos_dst

With an example:

svnadmin dump /var/lib/svn/old_repo \
    | svndumpfilter include trunk/my_project/common_dir \
    | svnadmin load /var/lib/svn/new_repo

If you don't want history, you can use svn export to get a clean folder without the .svn folders and then svn import into your other repository.

With history, you would need to use the svnadmin dump. You would then use svndumpfilter to filter for only the parts or paths you want to use before using svnadmin load.

Topics to read:

  • Migrating Repository Data Elsewhere
  • Filtering Repository History