SVN move single directory into other repository (with history)
Asked Answered
K

1

43

Related question: Moving repository trunk to another’s branch (with history)


I know that one can dump a complete SVN repository with history and load it into a user-defined (sub)directory of the target repository using:

// in source repo
> svnadmin dump . > mydumpfilename

// in destination repo (backslashes because I'm using Windows)
> svnadmin load . < mydumpfilename --parent-dir some\sub\directory

But this will import the full repository into the target repository's sub-directory. What I want is to define a sub-directory in the source repository that should be exported. Something like svnadmin dump . --source-path old\sub\dir > mydumpfilename.

How can I achieve that? If TortoiseSVN can do that, please say so ;)


SOLUTION: Thanks to Tim Henigan's answer, here's the correct way to do it:

// execute in destination repo
svndumpfilter include source\sub\dir < mydumpfilename | svnadmin load . --parent-dir destination\sub\dir

Hope this will help others, too...

Kg answered 25/2, 2010 at 20:42 Comment(4)
I think you can't do that, other than manually copying and re-applying every change, as subversion revisions are repository wide, so moving a single directory with history doesn't really apply in this case. i.e. not single files are revisioned but the whole repository is revisioned and diffs of the whole repository are storedHalvah
Actually this is only half of the story. You have to remove the directory in the source repository, too, by rebuilding it using svndumpfilter exclude source\sub\dir of course, see #205796Tangelatangelo
To avoid empty padding revisions, one should consider to add --drop-empty-revs --renumber-revs to the command line. See #9791817Vazquez
The "Solution" has created a lot of transactions in my destination, with lines: ` <<< Started new transaction, based on original revision 1404 -------- Committed new rev 4213 (loaded from original rev 1404) >>> ` but actually nothing shows in the repo-browser.Hebrew
G
22

Check out svndumpfilter and this section on Repository Maintenance.

Once you have a dumpfile for the entire old repository, you can use svndumpfilter to extract just the portion that you want.

I am not aware of a way to do this with TortoiseSVN.

Greaves answered 25/2, 2010 at 20:47 Comment(1)
And if you're confused why it's not working on your local machine, it's because svndump is supposed to be run on the actual repository source. Use svnrdump instead -- #8866535Bioscopy

© 2022 - 2024 — McMap. All rights reserved.