svn dump -> path rename via windows powershell -> struggle with malformed dumpfile header

The title says it all 🙂
What i want is to dump a folder from one project and store it into another. Both folders (src: proj1/trunk/supplies, dest: extlibs/trunk) are in the same repository. My problem is that the when i load the “normal” dumpfile, the previous folder’s path is kept and will be recreated at the new location (extlibs/trunk/proj1/trunk/supplies). So i’ve tried to change the path manually with win7 powershell:

svnrdump dump https://localghost/svn/test_repo/proj1/trunk/supplies |           \ 
% {$_ -replace "Node-path: proj1", "Node-path: extlibs"} |                      \
% {$_ -replace "Node-path: extlibs/trunk/supplies", "Node-path: extlibs/trunk"}|\
Out-File foo.dmp

Alternatively, i also used this command line:

svnadmin dump <local svn dir> | svndumpfilter include proj1/trunk/supplies | \ 
% {$_ -replace "Node-path: proj1", "Node-path: extlibs"} |                   \
% {$_ -replace "Node-path: extlibs/trunk/supplies","Node-path: extlibs/trunk}|\
Out-File foo.dmp

However, when i use svnadmin load or svnrdump load to upload the path-modified dumpfile, i receive “malformed dumpfile header” error. If i change the path manually, i get MD5-checksum errors. I am really confused how to change powershell’s output in order to make dump load work. I’ve tried

.. | Out-File -Enc UTF foo.dmp
.. | Out-File -Enc ASCII foo.dmp

Does someone of you know how to change the dumpfile’s folder-path? Is my approach correct or is there a better way to change the repo-path?

I know that there are some tools out there but i can’t use them now. I have to do this “by hand” in order to get a deeper understanding, but it seems that i may think too complicated.

Thanks for your help and time. I hope one of you knows how to solve this problem.

  • Eclipse EGit, working with forked project. Getting updates from the original project
  • What is the best ruby api to git?
  • Getting rid of cmd-windows for git gui on Windows 7
  • Git config alias doesn't work anymore
  • Git rename from index.lock to index failed
  • Python shutil.rmtree: cannot remove git dir on win7
  • Kubuntu/Windows 7 dual-boot and git
  • “Open git bash here” and “Open command prompt here” disappeared from Windows explorer context menu
  • 2 Solutions collect form web for “svn dump -> path rename via windows powershell -> struggle with malformed dumpfile header”

    • You must not change dump-file by hand
    • You **must* to use svndumpfilter after dumping
    • In order to change “mount-point” of folder from dump, you must to use --parent-dir options in svnadmin load

    Read here, on SO, topic SVN: how to merge tags from separate projects and (linked in answer) Using svndumpfilter to extract a folder in it’s own repository blog-post

    @Lazy Badger: Actually the SVN redbean book clearly proscribes that you may edit the dump file for this very reason, with the expected warning that you do so carefully and without changing line terminator characters. In fact, for the example scenario discussed, they cite editing Node-path and Node-copyfrom-path in order to alter the path to which the dump file is restored:

    If you want your trunk, tags, and branches directories
    to live in the root of your repository, you might wish to edit your dump files, tweaking the Node-path and Node-copyfrom-path headers so that they no longer have that first calc/ path component.

    I’ve done this a number of times when using cvs2svn to dump CVS repos for import into a different SVN structure. I first create the dumpfile and then use sed to modify the Node-path and Node-copyfrom-path headers prior to loading the dump file into SVN. Works fine.

    Here’s a quick & dirty shell script I use (warning: no error checking, so use at your own risk). The old and new paths must be specified starting from the root node path.

    Usage: <script> <dumpfile> <oldpath> <newpath>

    echo "Replacing path starting with '$2' with '$3' in file $1..."
    sed -ri -e 's@^Node-path: '$2'(/|$)@Node-path: '$3'\1@' -e 's@^Node-copyfrom-path: '$2'(/|$)@Node-copyfrom-path: '$3'\1@' $1
    Git Baby is a git and github fan, let's start git clone.