Split Up a Multi-Project SVN Repo
Abstract
I have decided to reorganise my Subversion repos for a while now. Mainly due to historical reasons, the repo has contained multiple projects, which has meant that revision numbers are spread throughout the code base of all projects. The time has come to think about splitting the repo along project lines and generating new project-specific repos instead.
Advantages of multi repo model
- Distributed disk space usage - one could move different projects to different machines if disk space becomes a problem for the repo server
- Per project hook tuning - different hooks for different pojects
- Per project revision numbers - may be better than a unified number across all projects
Disadvantages of multi repo model
- More than one repo URL to remember
Splitting the Repo
Currently, the single repo contains these projects:
proj1/ proj2/ proj3/ proj4/
My aim is to split the above into separate repos. Most of the projects contain this structure:
proj1/ branches/ tags/ trunk/
Method
For example, separating out the new proj1 project from the existing all-projects repo
Long Way Round
First of all, dump the entire repo to a flat file
$ svnadmin dump /srv/svn/repos > repos-dumpfile
Next, use svndumpfilter to reload the dump into a new flat file whilst including only the project path you want - there are two options here to be aware of: –drop-empty-revs does not generate empty revisions (that is revisions where nothing happened to the project of interest); –renumber-revs does what it says - it renumbers revision numbers from 1 onwards, only touching numbers missed by –drop-empty-revs
$ cat repos-dumpfile | svndumpfilter include proj1 --drop-empty-revs / --renumber-revs > dumps/proj1-dumpfile
Short Way Round
Does the same as above, without giving you a potentially large dumpfile - good if disk space is an issue.
$ svnadmin dump /srv/svn/repos | svndumpfilter include proj1 --drop-empty-revs / --renumber-revs > dumps/proj1-dumpfile
Editing the Dump File
Next, to remove any reference to a top level directory (i.e. proj1/branches, proj1/trunk etc.) remove the lines referring to the directory creation, using a text editor:
Node-path: proj1 Node-action: add Node-kind: dir Prop-content-length: 10 Content-length: 10
Then remove any reference to the path in the Node-path and Node-copyfrom-path. This can be achieved by using the following command:
$ sed -i 's/Node-path:\ ops\//Node-path:\ /g' dumps/proj1-dumpfile $ sed -i 's/Node-copyfrom-path:\ ops\//Node-copyfrom-path:\ /g' dumps/proj1-dumpfile
Importing the New Repo
Simple:
$ svnadmin create proj1; svnadmin load proj1 < dumps/proj1-dumpfile
About this entry
You’re currently reading “ Split Up a Multi-Project SVN Repo ,” an entry on chris ramsay
- Published:
- 11.3.08 / 6pm
- Category:
- Linux, Subversion










No comments
Jump to comment form | comments rss [?] | trackback uri [?]