astrofrog
astrofrog

Reputation: 34091

Migrating a directory to a different svn repository

I have code in an svn repository, call it repository A. Now say that I need to move the contents to repository B, but repository B has already been active for a while for other projects. Is it possible to move a particular directory from repository A to repository B, preserving the file history? Normally, to migrate an entire repository to a new server, I would do:

svnadmin dump -r 0:179 rep_a > rep_a.dump
svnadmin create rep_b
svnadmin load rep_b < rep_a.dump

However, this acts on the whole repository and assumes repository B is empty to start with (I think). I can of course export the directory in question and import it into repository B, but I lose the version history.

Is there an easy way to move a particular directory from A to B without losing the version history?

Upvotes: 1

Views: 386

Answers (2)

RedGlyph
RedGlyph

Reputation: 11569

Let's say you want to copy directory trunk/project of rep_a into rep_b, you have to use this command:

svnadmin dump rep_a | svndumpfilter include trunk/project | svnadmin load rep_b

The revisions related to rep_a will be added to the history of rep_b.

Be careful with that and make a backup before, of course. Also, it can be tricky if you have common directories, then you will have to remove directory creations from the dump (to avoid creating the same directories twice).

Upvotes: 3

sbi
sbi

Reputation: 224069

Look at Filtering Repository History in the SVN book.

Upvotes: 0

Related Questions