Sometimes it appends that a project is divided in different sub project. Each one then, can earn ti’s own prioriry and become a full project.

If everything was stored into the same svn repository, how can you move away one directory of it without loosing all the commit history?

Here’s how :

1. create a dump from the repository

To create a dump file use the svnadmin dump command or your svn online service admin page.

svnadmin dump [my repo url] | gzip > dump.gz

2. check the first directory level

use this script to check the first directory level contained in your dump file

gzcat dump.gz | egrep -a "^Node-path" | cut -d '/' -f 1 | cut -d ':' -f2 | sort | uniq

3. split into multiple dumps

Now it’s time to split this. To achieve this we can use svndumpfilter.

Exec this line for every directory you want to separate

gzcat dump.gz | svndumpfilter include directory1 | gzip > dump_directory1.gz

You can even separate more than one directory per file

gzcat dump.gz | svndumpfilter include directory1 directory2 | gzip > dump_directory12.gz

4. import every dump into different repositories

gzcat dump_directory1.gz | svnadmin load [my new repo url 1]

gzcat dump_directory2.gz | svnadmin load [my new repo url 2]

 

Comment