Thursday, 22 September 2011

SVN Dump Parts Of A Repository

Assuming the following SVN repo structure:
- repository root
| - project1
| - project2
| - project3
To dump the project1 history into a portable, re-creatable format, first you use svnadmin dump, like this:
svnadmin dump [path to repo] > repo.dump
Which creates a dump of the entire repository into a file called repo.dump. This might take some time and is CPU intensive so it would be best to perform this outside of normal work hours...
Then use svndumpfilter to filter just for the project1 folder (see folder tree above):
svndumpfilter include project1 < repo.dump > project1.dump
If you have nested repositories, then it breaks with a syntax error. To get around this you need to run the dump multiple times using the ‘exclude’ directive until you have what you want:
svndumpfilter exclude project2 < repo.dump >> project1.dump
svndumpfilter exclude project3 < project1.dump >> project1.dump
At the end you get a full svn repository that could be re-created anywhere, like this:
svnadmin create /var/svn/project1svnadmin load /var/svn/project1 < project1.dump
mkdir -p ~/workingcopies/project1svn co file:///var/svn/project1~/workingcopies/project1/

Possibly Related Posts

No comments:

Post a Comment