Moving SVN repositories data with history as subfolders into another repository

There are two ways to accomplish the task. Depending on Subversion server distribution and task complexity you may find one of them easier or more convenient than the other.

Filtering repository history with svndumpfilter tool

The solution is quite tricky because Subversion repository history filtering works based on paths you specify to include or exclude in a repo dump output. In short you should do the following:

  1. Dump your current repositories with svnadmin dump,
  2. Filter out only needed repository path in the dumps with svndumpfilter,
  3. Load the filtered dumps to another repository with svnadmin load.

You can also use svnrdump tool (exists in SVN 1.7 and later) to perform the dump and load process remotely. See svnrdump dump and svnrdump load.

I strongly advise you to read the following articles from the SVNBook related to the process:

  1. Filtering Repository History
  2. svnadmin dump
  3. svnadmin load
  4. svnrdump dump
  5. svnrdump load
  6. svndumpfilter

Suppose you have repository C:\Repositories\REPO and folder /trunk/abc in this repository. See the sample steps to move folder /trunk/abc to another repository C:\Repositories\REPO2.

  1. Ensure that all commits that affect /trunk/abc path and its descendants do NOT affect any other path. For example, there is no commit which adds files to /trunk/abc and /another_folder at the same time or copy files from /another_folder to /trunk/abc etc.

  2. Create dump of the REPO repository:

    svnadmin dump C:\Repositories\REPO > REPO.dump

  3. Filter out unnecessary paths from the REPO.dump file:

    svndumpfilter include /trunk/ABC < REPO.dump > filtered.dump

  4. Create empty /loaded folder in the C:\Repositories\REPO2 repository.

  5. Load dump to that folder:

    svnadmin load --parent-dir /loaded C:\Repositories\REPO2 < filtered.dump

That’s it!

Repository replication with svnsync tool

The solution is also tricky however a complex repository filtration may be a bit more convenient with it than the approach described above.

The approach is to replicate the repository with svnsync after configuring path-based authorization rules that deny read access to any paths that need to be filtered out from repository history.

Unlike svndumpfilter, svnsync will automatically translate copy operations with an unreadable source path into normal additions, which is useful if history involving copy operations needs to be filtered.

Leave a Comment