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:

  • How to include MySQL database schema on GitHub?
  • Best way to import SVN tags and trunk into new Git repo? (Can't use clone due to size of repo)
  • GIT : what does mean “to dump”?
  • Svnadmin load from dumpfile causes “file not found error”. Help?
  • Why is a SVN dump of a single revision larger than a full dump?
  • Merging SVN Repositories: I loaded old repository onto an existing repository. How do I switch my working copy?
  • 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.

  • Similar Java access code (methods) of Git/JGit as SVNKit
  • Migration to SVN, confused about deleting old files
  • How does merging conflicts in Git compare to merging conflicts in Subversion?
  • How to configure SVN web access for different write permissions?
  • Setting up Continuous Integration with SVN
  • How can I speed up SVN updates?
  • 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>

    #!/bin/bash
    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.