43

I am working with an SVN repository with many projects. I need to move a few of the projects out of that repository into individual repositories, one for each project, keeping the history.

I've been able to use svnadmin dump to dump the entire repository and svnadmin load it into another repository, but I can't find a way of dumping only one project from the original repository so I can load it into the new one. Is this possible? If so how?

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Stacey Richards
  • 6,338
  • 7
  • 34
  • 40
  • 1
    I like to share one pitfall that i ran into: filtering for a subfolder, also filters out the creation of the parent folder. So one has to create the parent folder in the target repository manually. – Jens Piegsa Oct 09 '13 at 17:04

2 Answers2

66

You can use the svndumpfilter utility to do this. The SVN book has a good explanation of how to do this.

For instance, one way would be:


$ svnadmin dump /path/to/repo 
     | svndumpfilter include /proj > dump-file
$ svnadmin create /new/proj/repo
$ svnadmin load --ignore-uuid /new/proj/repo < dump-file
$ svn rm file:///path/to/repo/proj
bahrep
  • 26,679
  • 12
  • 95
  • 136
Avi
  • 19,313
  • 3
  • 53
  • 69
0

Just an small addition to @Avi answer and @Kit comment.

If you use svndumpfilter, you may lose a commit that is necessary for loading the repository (source).

In my case:

cat dump | svndumpfilter --drop-empty-revs --renumber-revs include trunk/project > project.dump 
svnadmin load --ignore-uuid /opt/svn/newlocation < project.dump
<<< Started new transaction, based on original revision 1 
svnadmin: File not found: transaction '0-0', path 'trunk/project'

The solution was to commit an upper directory trunk first.

Jose Gómez
  • 2,891
  • 2
  • 28
  • 52
Leos Literak
  • 7,392
  • 11
  • 59
  • 114
  • 1
    This solution renumbers the revisions. When you don't want to renumber the revisions just don't use --drop-empty-revs and --renumber-revs. – Prikkeldraad Apr 20 '16 at 12:07