Search code examples
svnbatch-filevisualsvnvisualsvn-server

Move Nested SVN Repository


I need to move a SVN repository from one server to another in Windows. The trick is that I want to exclude everything except the trunk, branches, and tags from a project within a nested repository.

I currently have one large repository that all the projects are under (MyBigRepo). The current structure is:

/Repositories/MyBigRepo/MyProject1/trunk
/Repositories/MyBigRepo/MyProject1/branches
/Repositories/MyBigRepo/MyProject1/tags

/Repositories/MyBigRepo/MyProject2/trunk
/Repositories/MyBigRepo/MyProject2/branches
/Repositories/MyBigRepo/MyProject2/tags

/Repositories/MyBigRepo/MyProject3/trunk
/Repositories/MyBigRepo/MyProject3/branches
/Repositories/MyBigRepo/MyProject3/tags

I only want to move MyProject1, but I want to exclude the main folder MyProject1 and just move trunk, branches, and tags from the MyProject1 repository. I don't want to move MyProject2 or MyProject3. In other words, my goal is to form my new repository similar to below.

/Repositories/NewRepo/trunk
/Repositories/NewRepo/branches
/Repositories/NewRepo/tags

Here's the batch file I created to do the work:

:: Create a dump of the old repo
svnadmin dump %OldRepoPath% > %MyBigRepoDumpFile%

:: Remove the other projects
svndumpfilter include "MyProject1" < %MyBigRepoDumpFile% > %MyProject1DumpFile%

:: Create a new repo
svnadmin create %NewRepoPath%

:: Load the dump into the new repo
svnadmin load %NewRepoPath% < %MyProject1DumpFile%

My problem is that the batch still creates the MyProject1 directory under the %NewRepoPath% like this:

/Repositories/NewRepo/MyProject1/trunk
/Repositories/NewRepo/MyProject1/branches
/Repositories/NewRepo/MyProject1/tags

Is there a way to either exclude the extra level (MyProject1) from my dump file or move it up a level, still preserving the history?


Solution

  • I think your best bet is to move it "as is" (with the extra level present) and then redo the structure via svn copy in the new repository.

    There is also an option of tweaking you dumpfile as described here.