Search code examples
svndumpsvnadmin

Can I take a svn dump and reparent a directory?


I am moving SVN providers, and in doing so all of my repos start like https://www.provider1.com/myrepo1 so I've done a svn dump on that repo, and within the repo my paths start trunk/src, trunk/lib, etc. However, my new provider gives me only a single URL for me to dump my projects into those. So I need to rename all of the directories in the dump to add a new parent to each path so it might look like myrepo1/trunk/src, myrepo1/trunk/lib, etc. I realize I can create a new directory in each URL repo, and move the folders into it. But that doesn't change the history of it. So is there a way to use svndumpfilter to add this parent into the dump file directly? If not what should I do?


Solution

  • Here is what I did to get it to work. I didn't use svndumpfilter after all. Instead I created a new repository using svnadmin then created a parent directory in that newly created svn repo. Then loaded the dump using svnadmin load telling it to put that dump under the new parent directory.

    First pull down the project and create a dump of that project:

    svnadmin create project1
    emacs repo/hooks/pre-revprop-change
    chmod 755 project1/hooks/pre-revprop-change
    svnsync init file://$(pwd)/project1 https://somehost.com/svn/project1
    svnsync sync file://$(pwd)/project1
    svnadmin dump project1 > some.dump
    

    Next create a new svn project for which we'll load the dump into the new parent directory:

    svnadmin create someDirectory
    svn mkdir -m "Add root directory to project" file://$(pwd)/someDirectory/THE_PARENT_NAME
    cat some.dump | svnadmin load --parent-dir THE_PARENT_NAME someDirectory