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?

user9474
  • 2,448
  • 2
  • 25
  • 26
  • This probably belongs over on http://www.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 08 '10 at 21:45

2 Answers2

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

CaCl
  • 99
  • 4
  • 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 08 '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
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.

Mark Henderson
  • 68,823
  • 31
  • 180
  • 259