Skip to content


SVN HowTo move subdirectory from one repository to another

For some time now I’m working on a C++ project, committing my changes to my common C++ repository as a subdirectory. Today I had the idea to have a own SVN repository for this project. Doing some Google search showed me the way ..


Imagine there is a repository which looks like the following:

/var/svn-repos/cpp
* dir1
* dir2

and dir2 should now be migrated to a new, own repository like

/var/svn-repos/Project1

This is quite easy using svnadmin. First of all we create the new repository:

svnadmin create –fs-type fsfs /var/svn-repos/Project1

Now the moving. First dumping then reloading.

Dump of the old repository data:

svnadmin dump /var/svn-repos/cpp/ | svndumpfilter include \
–drop-empty-revs –renumber-revs /dir2 > Project1.svndump

svnadmin is the main administration tool for SVN repositories. Option dump dumps out the complete content of the repository, including the history, using a specific dump-format. svndumpfilter filters the dump stream regarding to the specified criterias. Using option include drops out everything which was not defined from the dump stream – only requested data gets into the dump file. With option –drop-empty-revs every dropped and therefor empty revisions are ignored, –renumber-revs renumbers all revisions which are still dumped out.

Finally the dump must be loaded into the new repository using svnadmin again:

svnadmin load /var/svn-repos/Project1 < Project1.svndump

Finished.

  • Share/Bookmark

No related posts.

Posted in Linux.

Tagged with , .


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Markus says

    Sehr hilfreich, vielen Dank. Die Optionen bei svndumpfilter mussten bei mir mit zwei “–” versehen werden:

    svndumpfilter include -–drop-empty-revs -–renumber-revs …

    Außerdem wird der komplette Pfad innerhalb des Repositories ins Dump übernommen (z.B. “/trunk/dir1/datei.cpp” und ich musste noch “/trunk” von hand anlegen, sonst kam es zu einer Fehlermeldung bei “svadmin load …”

    svn mkdir /path/to/new/repo/trunk

    bzw.

    svn mkdir https://svn.new.repo.url/trunk

    Praktisch wäre es, wenn man den Pfad gleich im Dumpfile los würde. Aber svndumpfilter bietet hier wohl keine Option. Hat jemand eine Idee dazu?



Some HTML is OK

or, reply to this post via trackback.

You can add images to your comment by clicking here.

Security Code: