SVN Server Problems/Tasks

Extract Subproject from Repository

If you have a repository containing some subprojects, like displayed afterwards, and want to separate one subproject, for example /calc/ … <pre>/

 calc/
    trunk/
    branches/
    tags/
 calendar/
    trunk/
    branches/
    tags/
 spreadsheet/
    trunk/
    branches/
    tags/</pre>
    

You first have to dump all the hole repository into a single dumpfile:

$ svnadmin dump /srv/svn/repos > repos-dumpfile
* Dumped revision 0.
* Dumped revision 1.
* Dumped revision 2.
* Dumped revision 3.
…

Next, run that dump file through the filter, first including only the wanted top-level directory (/calc/), and then excluding it. This results in two new dump files:

$ svndumpfilter include calc < repos-dumpfile > calc-dumpfile
…
$ svndumpfilter exclude calc < repos-dumpfile > others-dumpfile

At this point, you have to make a decision. Each of your dump files will create a valid repository, but will preserve the paths exactly as they were in the original repository. This means that even though you would have a repository solely for your calc project, that repository would still have a top-level directory named calc. If you want your trunk, tags, and branches directories to live in the root of your repository, you might wish to edit your dump files, tweaking the Node-path and Node-copyfrom-path headers so that they no longer have that first calc/ path component.

sed 's/Node-path: calc/Node-path: /g' calc-dumpfile 

Also, you'll want to remove the section of dump data that creates the calc directory. It will look something like the following:

... 
Node-path: calc
Node-action: add
Node-kind: dir
Content-length: 0
...

See also: svndumpfilter - red-bean The Manual

Log In