Moving a folder from one SVN repository to another

repositorysvntortoisesvn

I have a set of repositories with a structure similar to the following:

/Source
  /branches
  /tags
  /trunk
    /FolderP
    /FolderQ
    /FolderR

/Target
  /branches
  /tags
  /trunk
    /External
      /Library1
      /Library2
      /Library3
    /Internal
      /FolderA
      /FolderB
      /FolderC
      /FolderX
      /FolderY
      /FolderZ

I would like to move the folders /Source/trunk/FolderP, /Source/trunk/FolderQ and /Source/trunk/FolderR to /Target/trunk/Internal such that:

  • /Source/trunk/FolderP becomes /Target/trunk/Internal/FolderP
  • /Source/trunk/FolderQ becomes /Target/trunk/Internal/FolderQ
  • /Source/trunk/FolderR becomes /Target/trunk/Internal/FolderR

I should then have the following repository structure:

/Target
  /branches
  /tags
  /trunk
    /External
      /Library1
      /Library2
      /Library3
    /Internal
      /FolderA
      /FolderB
      /FolderC
      /FolderP
      /FolderQ
      /FolderR
      /FolderX
      /FolderY
      /FolderZ

It is imperative that history be maintained during the move.

I have looked at the following 2 questions asked previously which seem to be similar:

I haven't had much luck with the suggested solutions. Specifically, I get an error when I run the svndumpfilter command, which states that:

svndumpfilter: Invalid copy source path `/branches/name-of-a-branch/.../File.cs`

What's going on and how can I get around this problem?

Edit:

One workaround that I am currently trying is to:

  • Clone the /Source repository into another one called /Temp
  • Delete the files and folders from /Temp which I do not need and checkin all changes
  • Dump /Temp repository by calling "svnadmin dump X:\Repositories\Temp > X:\Dumps\Temp.dmp"
  • Load Temp.dmp into /Target repository by calling "svnadmin load –parent-dir trunk\Internal\Temp X:\Repositories\Target < X:\Dumps\Temp.dmp"
  • Checkout/update /Target repository
  • Use TortoiseSVN to move folders out of /Target/trunk/Internal/Temp/trunk/** up into /Target/trunk/Internal (by highlighting the ones I want in Windows Explorer, pressing Control+X and then changing folder to /Target/trunk/Internal and issuing the pasting with TortoiseSVN

NB: The above assumes that svn is maintaining all repositories in X:\Repositories folder and one is using X:\Dumps folder as working folder.

This will clobber revision numbers obviously, but will maintain history. Hopefully, your commit comments do not include references to revision numbers.

Someone else has mentioned an svndumpfilter3 Python script, but I have never used Python and do not wish to learn to use Python, just for this.

Best Answer

Unless you also want to also change the history of FolderP, FolderQ, and FolderR, why don't you simply svn move them to Internal?

Note that svnadmin load takes an option --parent-dir arg, where arg is the parent folder where you want your imported dump to appear under. So
svnadmin load --parent-dir /trunk/Internal dump_of_source_repo target_repo
should import all of the source repo under /trunk/Internal in the target repo.