How do I dump one project out of an SVN repository which contains multiple projects?
Asked Answered
S

2

42

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?

Shayne answered 3/12, 2008 at 13:4 Comment(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.Lanie
R
67

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
Rotative answered 3/12, 2008 at 13:33 Comment(7)
Thanks Avi, I've just read the docs and it look like that's what I needed.Shayne
you forgot to input the dumpfile to the svnadmin load command.Bruell
Thanks, Wimmel. I didn't actually forget; I forgot to escape the less-than sign. Fixed now.Rotative
it might be worth noting that the args --drop-empty-revs and --renumber-revs can be used with svndumpfilter to clean up gaps in the revision numbersCleruchy
Can any user perform these actions or do they require admin privileges?Applique
@Applique any user can do this if they have access to the svnadmin command and the raw repo files (ie access to the server its running on).Transept
What if I want to dump multiple projects..?Intensifier
R
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.

Remonaremonetize answered 20/10, 2014 at 14:48 Comment(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.Broussard

© 2022 - 2024 — McMap. All rights reserved.