Published:
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.
Just back from vacation so its a short one this week I typed up on the flight back.
In a previous post I explained about the SVNParentPath directive and how it could be used to remove the need to manually add each new repository to the location section of our apache vhosts file. Today I am going to take this one step further by giving subversion its own dedication vhost.
Define the vhost
Defining the vhost is the same as normal, except we do not specify the documentroot as it is not used here. Also note that the location tag now uses a single "/" instead of "/svn".
<VirtualHost *:80>
ServerName svn.yourdomain.com
<Location />
DAV svn
SVNParentPath "C:/svn_repository/"
SVNListParentPath on
---snip---
</Location>
</VirtualHost>
Now we can access our repositories from "http://svn.yourdomain.com/" and "http://svn.yourdomain.com/specificRepository". However this creates a problem for styling.
Problem Styling File Links Broken
In a previous article on subversion I mentioned the use of the svnindex.xsl file to style the repository listing. This file was placed in the root of "yourdomain.com" which was a level above the svn repositories. Now that the web root is also the repositories root we are unable to link to the svnindex.xsl file. Note that the path to the svnindex file is a url path.
The reason for this is that once we enter the root of svn.yourdomain.com we are directed in repository browsing which bypasses the svnindex file even if we place it in the root directory.
Solution: Host And Reference The Styling Files In Their Own Repository
What everybody seems to forget is that SVN is itself a filesystem, so why not use it to serve up the svnindex file directly to apache. Not only is this really simple to do, it allows us to version control the svnindex file itself.
As I am still playing catch up at the moment I will outline how to implement this solution in next weeks posting.
Reader Comments