0

Right now I'm trying to move projects from an old SVN (1.6.12) to a new one (1.8.13).
In the process I'd like to change the legacy folder-structure from:

[root]   
  -trunk
    -<subfolder1>
      -<projectfolder1.1>
      -...
    -<subfolder2>
      -<projectfolder2.1>
      -...

Into:

[root]
  -<project1.1>
    -trunk
    -branches
    -tags
  -<project2.1>
    -...

The tricky part (at least for me) is that I'm confused about how to preserve the history while doing so. I've already read several articles about the svnadmin dump / svndumpfilter tools and even something about manually fiddling around with the SVN-dump-files and now I'm wondering about:

  • compatibility in respect of the versions mentioned above?
  • what would be the correct roadmap to accomplish my goal?
  • are there any tools available to do this? Maybe from client-side without having the need of SSHing and modifying on the server.

Any help/insight would be highly appreciated! Thanks in advance.

Community
  • 1
  • 1
SimonSez
  • 7,399
  • 1
  • 30
  • 35

2 Answers2

2

Short answer: Don't do this in one step.

Long answer: That's a lot of change to attempt in a single pass while preserving history and everything else.

Take it one step at a time:

  1. Reorganize the repository on your current server using the appropriate svn commands - svn mv, svn cp, svn rename, etc. You can do this either against URLs or from within a working copy (or both) - this can be accomplished 100% client-side. This will preserve history (as long as you do it properly).
  2. After the reorg is complete, use the svnadmin dump/svnadmin load cycle to migrate your repository to the new server. You can use svnadmin rdump to create the dump file from the source using a client computer, but you do need access to the server to svnadmin load on the new one.

As always, make sure you have good backups (test a restore!) and try this on a test version of your repository before doing it on one that matters.

alroc
  • 27,574
  • 6
  • 51
  • 97
  • This is definitely dangerous to try to do all at once. I recommend migrating to the new server *before* doing the re-organization, though. That way, if you mess something up during the re-org, your source repo is still pristine so you can simply delete the new repo and start over. – bta Aug 27 '15 at 22:19
  • Anything you mess up in the reorg can be undone. And you should have a clean backup of it anyway. – alroc Aug 28 '15 at 01:19
  • Thanks for the suggestion, I'll give it a try. Just to clarify: I never meant to solve my problem in one step but wasn't sure about a good starting point. – SimonSez Aug 28 '15 at 08:50
0

For all the others who also know how to operate but don't really know how to administrate a SVN, here is what finally worked for me:

First I followed @alroc's suggestion to restructure the original repo via client-side by using the standard SVN commands and moving the old content into the newly created trunk (thx and +1 for that!). Result:

[root]
  -trunk
    -<subfolder1>
      ...
  -<tmpfolder>
    -<project1>
      -trunk (old content moved here)
      -branches
      -tags
    -<project2>
      -...

After that I exported my repo via svnadmin dump and tried to filter out the content of my tmpfolder via svndumpfilter --drop-empty-revs --renumber-revs include tmpfolder < DUMP_FILE > FILTERED_DUMP but I got the following error

svndumpfilter: Invalid copy source path '/trunk/oldfolder/oldsubfolder'

because of the now missing links to the original locations which got lost during restructuring.
To get around this I've tried the following solutions

  • added the exclude [res1] [res2] [...] switch to the svnadmin dump command - same error
  • added the --skip-missing-merge-sources switch to the svnadmin dump command - same error
  • added the include [res1] [res2] [...] switch to the svnadmin dump command - filtering works but same error as above while importing

Finally I found someone with the same problem here who mentioned the use of svndumpfilterIN. After downloading this file to the original-repo server (and adding the right to execute) I executed it with the following command:
python svndumpfilter.py ORG_REPO_DUMPFILE -r ORG_REPO_LOCATION -o FILTERED_DUMP_NAME include tmpfolder.
This tool found all missing links via the specified ORG_REPO_LOCATION and untangled all dependencies while giving new and clean revision numbers for the filtered dump for me to import.

The only downside was that there was an unnecessary parent folder (tempfolder) I didn't want so I moved all projects into the root of the original-repo and renamed the original-trunk into trunk2 to be able to exclude it in the svndumpfilterIN-tool.

[root]
  -trunk2 (renamed)
    -<subfolder1>
      ...
  -<project1>
    -trunk
    -branches
    -tags
  -<project2>
    -...

Lastly I filtered via python svndumpfilter.py ORG_REPO_DUMPFILE -r ORG_REPO_LOCATION -o FILTERED_DUMP_NAME exclude trunk2 and imported this filterd dump into my new repository with svnadmin load.

Community
  • 1
  • 1
SimonSez
  • 7,399
  • 1
  • 30
  • 35