4

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.

Community
  • 1
  • 1
Umar Farooq Khawaja
  • 3,925
  • 1
  • 31
  • 52
  • It's much later now, today [I found a build-in support in TSVN](http://stackoverflow.com/a/41592290/2932052). Hope that helps others to find a solution more quickly. – Wolf Jan 11 '17 at 13:33

3 Answers3

2

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.

sbi
  • 219,715
  • 46
  • 258
  • 445
  • That's pretty much what my workaround is doing. Are you sure svn move will work across difference repositories? I am not so sure. – Umar Farooq Khawaja Jun 25 '10 at 11:25
  • @Umar: Actually I'm sure it will __not__ work across repositories. But you could move them after importing. Anyway, as I added later, you can import into a specific folder, too. – sbi Jun 25 '10 at 12:12
1

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.

Umar Farooq Khawaja
  • 3,925
  • 1
  • 31
  • 52
  • Thank you for the workaround, but unfortunately I can't do that either because I can't stop the company's svn server. I finished just copying the files to server and lost the history ( it was just 1-day history, so not a big deal )... Anyway I would like to know of a way ( if any ) to do this move without having admin privileges in the server... – Filipe Felisbino Oct 02 '12 at 11:40
  • 1
    Assuming you have only user level access to the Subversion repository and you want to maintain history as well, the only other option would be to create a target folder or repository, checkout the first revision of the source repository, merge it into the checkout location of the target (svn adding new files, svn deleting missing files), commit, repeat till you get to the last revision of the source. You could probably write an MSBuild script to automate this, but it almost sounds like too much hassle and I shudder to think of what if something went wrong. Do NOT do this. – Umar Farooq Khawaja Oct 03 '12 at 13:26
1

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.

Wolf
  • 9,679
  • 7
  • 62
  • 108
  • 1
    Only now I read the hidden *`It is imperative that history be maintained during the move.`*, but I think this answer is still useful in some cases. – Wolf Jan 11 '17 at 13:53