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?

  • 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. – Mark Henderson Apr 8 '10 at 21:45

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

  • 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. – David Pashley Apr 8 '10 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 '12 at 10:42

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.

  • As CaCl has pointed out, you can use svndumpfilter to filter irrelevant revisions out of the dump. – David Pashley Apr 8 '10 at 22:34

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.