SVN Move code with history between two repositories

ted picture ted · Oct 22, 2012 · Viewed 11.9k times · Source

I have to work on two repositories and want to move one directory with code between the two while keeping revisionhistory.

I read a few questions here on SO, but am still not sure which way to go. Our Repositories are HUGE (files (orkingcopy) not including revisions>several GB), since everything is checked in (code +designdata + ...).

The solutions I have seen so far are:

  1. svnadmin dump + filter + import: not an option due to repository size
  2. svnsync: We already have data in the second repository (the repositories are huge already, I don't think merging them is a good idea, besides decidng that is not my job), and from what I gathered this requires the second repository to be empty.
  3. Third Party Solution: crashes repeatedly, because it can not delete a file because "another process hast the file opened" (enevthough i can remove the file via the os, and it gets created by the script)

Are there other solutions, approaches to this, or am I missing something about one of the solutions?

Answer

maddoxej picture maddoxej · Oct 22, 2012

The svnadmin dump + filter + import works even with large repositories.

There are some things you need to do for performance. Find out which revision was the one that first created the folder you want to copy. Then check the log to find the last revision that modified anything in that folder. You only need to dump revisions in that range.

Use the --incremental flag to svndump.

Do not try to use the Deltas flag with SVN Dump. SvnDumpFilter won't work on dumps created with "deltas". Don't try to save the huge dump to a file and and run SvnDumpFilter on the file. Instead do it in one step with a pipe.

If your start revision was 10000 and your end revision was 20000 and the path you want to copy was projects/source, the command should look like

svnadmin dump --incremental -r10000:20000 YourRepoPath | svndumpfilter include projects/source --drop-empty-revs --renumber-revs > source.dump

Followed by an svnadmin load command to load the dump into your other repo.