4
votes

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.

3
It's much later now, today I found a build-in support in TSVN. Hope that helps others to find a solution more quickly.Wolf

3 Answers

2
votes

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.

1
votes

The following workaround is for the specific situation that filipenf is in, i.e., no access to svnadmin on the Subversion server.

If you can physically move files into place on the Subversion server in the folder being used to store repositories, then you're sort of in luck.

Before you do any of the following, please take backups, in case of inadvertent corruption of data. Liberal usage of backup can never be over-emphasized. Now, the workaround:

  1. Stop the local Subversion server on your local repository so that the repository is flushed and no changes can be made.
  2. Stop the company Subversion server.
  3. Copy the directory representing the local repository into the repository folder of the company Subversion server alongside the folders representing other repositories.
  4. Restart the company Subversion server (and the local one if required).

This should give you new repository in the company Subversion server with all the history intact.

You can then use svn:external properties to bring in code from this new repository into other repositories on the company Subversion server.

Please note that this involves the ability to physically copy files onto the company Subversion server, rather than creating a new repository or folder using the user interface published by the Subversion server.

1
votes

For this, I found a great support within TortoiseSVN version 1.9.4+:

  • Open Log (TortoiseSVN > Show log)
  • select all revisions that made up the project
  • right-click into the selection, then Merge revisions to...
  • select target folder (should be in a up-to-date working copy)
  • wait for TSVN to copy your files, folders and properties...
  • in Explorer window: commit target folder

Disclaimer

This method strips history and may work only under certain circumstances, but my situation obviously was exactly one of these (this is why I love TSVN: it really helps its users).

Background story:

I tried to convince a college to bring a small ("toy") project under version control, so I cleaned out our SVN "playground" repository. He then committed all he thought that was source code (naturally much more than that), I then added the appropriate ignore patterns, he immediately started to do productive work under VC (forgetting that this all takes place in the "playground" repo). Now I had to convince him to move to a persistent repository and searched for an easy-to-apply and easy-to-teach method, to enable him to do the first commit in the new site.