5

How do you migrate a part of an SVN repository into a new repository?

To migrate the contents of a complete SVN repository into a new repository, one has to dump the old repository first:

svnadmin dump /path/to/repository > repository-name.dmp

and then load it into the new one using svnadmin load.

But I'm not sure how to just migrate a part. Do I still have to dump the whole thing? Do I grep for the part that I want?

To just dump myproject, I tried this, but it didn't work:

svnadmin dump /path/to/repository/myproject

Any ideas?

1
  • This probably belongs over on stackoverflow.com as they're usually far more experienced than us at using SVN. If others agree, we will move it automatically for you, so no need to re-post. Apr 8, 2010 at 21:45

2 Answers 2

7

If you want to pull over part of the repository, a particular subdirectory. You'll first need to dump the entire repository, run svndumpfilter to include that directory, and finally load things into a clean repository.

Lets say you want to move directory Calc, you would do:

svnadmin dump repos > dumpfile
cat dumpfile | svndumpfilter include Calc > dumpfile-Calc

Then to load the Calc directory back properly you would do:

svnadmin create newrepos
svnadmin load Calc < dumpfile-Calc

This is taken and slightly modified from the docs: http://svnbook.red-bean.com/en/1.0/ch05s03.html

2
  • This is the exact way to do this. There is something about renumbering revision numbers if I recall correctly, but it should be mentioned in the documentation you linked to. Apr 8, 2010 at 22:35
  • only comment would be to this answer is that in the last line, you mention "Calc" but in the line above, you have "newrepos" .. chose one or the other : )
    – sdolgy
    Feb 19, 2012 at 10:42
0

When I wanted to do this, I simply did an svnadmin dump and an svnadmin load, the same as you did, then I deleted everything else out of the repo.

The repo was only 3gb in size, so it wasn't such a huge deal, and for security it's not so good as you can obviously undo the deletes by rolling back, but it achieved the same thing, because I couldn't find a way to do it, with keeping the revision history.

1
  • As CaCl has pointed out, you can use svndumpfilter to filter irrelevant revisions out of the dump. Apr 8, 2010 at 22:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .