41

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...

Community
  • 1
  • 1
AndiDog
  • 68,631
  • 21
  • 159
  • 205
  • 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 stored – Zenon Feb 25 '10 at 20:49
  • 2
    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 http://stackoverflow.com/questions/205296/delete-file-contents-from-svn-history – Tino Jan 31 '12 at 12:52
  • 1
    To avoid empty padding revisions, one should consider to add `--drop-empty-revs --renumber-revs` to the command line. See http://stackoverflow.com/questions/9791317/svndumpfilter-drop-empty-revs-keeps-padding-revision – smkanadl Feb 09 '17 at 09:28

1 Answers1

20

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.

JaBe
  • 664
  • 1
  • 8
  • 27
Tim Henigan
  • 60,452
  • 11
  • 85
  • 78
  • 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 -- http://stackoverflow.com/questions/8866035/unable-to-do-an-svn-dump-error-e720002-and-format-errors – drzaus Jun 05 '15 at 20:02