Migrating part of Subversion repository to new server and repathing
I'm attempting to migrate part of an Subversion repository to a new Subversion server.
http://server1/svn/repo1/path1/path2/path3
-> http://server2/svn/repo2/path3
I've created a complete dump via:
svnadmin dump repo1 > repo1.dump
Filtered the dump via:
svndumpfilter include /path1/path2 --drop-empty-revs < repo1.dump > repo1_filtered.dump
Via Cygwin sed, I'm replacing /path1/path2:
sed -e 's,^Node-path: WM/BI,Node-path: ,' < repo1_filtered.dump > repo1_fixed.dump
While attempting the import the dump into a new/empty repository, I get the following error:
<<< Started new transaction, based on original revision 32
* adding path : ...svnadmin: File already exists: filesystem 'bi\db', transaction '0-2', path ''
I believe the problem is that the svndumpfilter is incl开发者_StackOverflowuding the path /path1/path2. Really, I only want the children of /path1/path2. After running sed, near the beginning of repo1_fixed.dump, I find:
2010-03-10T15:56*:59.595747Z
PROPS-END
Node-path:
Node-action: add
Node-kind: dir
Prop-content-length: 10
Content-length: 10
PROPS-END
My guess is that the empty node path is the real cause of the problem.
Any suggestions on how I should proceed?
I reproduced you problem fairly easily and you're true about your analsis. The issue is the revision creating the base folder.
If you remove this transaction from your dump, it imports correctly
sed -e "s,^Node-path: rep1/rep3,Node-path: ," < temp_filtered.dump > temp_hacke.txt
I did it manually, it's fairly easy : just look for lines with empty Node-path: and remove from previous "Revision-number:" to next "PROPS-END". Some python/awk/perl could do it (i didn't try).
If you don't have special things in this folder (like properties evolving over time), you should have only one occurence.
Another solution is to import your repository in a single folder instead of a subtree (in that case, just change your sed line to ,Node-path : newPath)
Note that I don't know of a tool which would do this for you.
精彩评论