Multiple repositories and subversion

Last time we looked at multiple projects which was a nice way of serving multiple projects from the same repository.

But what if we wanted our projects to be completely separated? Well, serving multiple repositories is the answer.

For some reason, this is sometimes seen as a tedious and long route to serve our projects. Nothing could be further from the truth. Multiple repositories are incredibly easy to set up and to serve and do solve issues related to version numbering and so on.

Let's get straight on. If you have been following the previous tutorials, you may well have project1 and project2 in the 'work' and 'repository' folders. You may also have an instance of svnserve running.

Let's stop svnserve and delete the old stuff:

killall svnserve
rm -rf /home/paul/repository
rm -rf /home/paul/work/*

Now we have a clean sheet to work from.

Start by creating a folder to hold our repositories and then, using svnadmin, create two new repositories (we'll keep the naming pretty simple):

mkdir repositories

svnadmin create repositories/project1
svnadmin create repositories/project2

Next, I'm going to create two incredibly simple projects and import them into the separate subversion repositories:

mkdir project1
touch project1/project1.txt

svn import /home/paul/project1 file:///home/paul/repositories/project1/trunk -m "import project1"

mkdir project2
touch project2/project2.txt

svn import /home/paul/project2 file:///home/paul/repositories/project2/trunk -m "import project2"

Notice that this time, for each initial import subversion reported:

Committed revision 1

Now the two projects are seperated. Had we used the technique described in the multiple projects article, project2 would have been committed as revision 2.

Delete the original project folders as we don't need them any more:

rm -rf project*

We could simply check out the projects on the same machine but that's not much fun. Let's setup svnserve to serve both repositories at the same time.

This is exactly the same as when serving one repository:

svnserve -d -r /home/paul/repositories/

That's it. It is incredibly simple to set up. Naturally, if you have a firewall, ensure you allow connections to port 3690 (the default svnserve port).

Checking out the different projects uses the same procedure as before. So from your workstation, issue the command(s):

svn co svn://123.45.67.890/project1/trunk project1

svn co svn://123.45.67.890/project2/trunk project2

The IP address is the address of your VPS.

Add, edit and delete files as you would for any other project under subversion control. Any commits you make will be for that project only.

PickledOnion.

Digg it | del.icio.us | reddit | StumbleUpon

Comments are closed for this article.