Hello,
I'm trying to use mod_dav_svn to host repositories that are arranged in
project directories and I can't get the configuration to work. My
projects look like this:
/srv/svn/project1/repo1
/srv/svn/project1/repo2
/srv/svn/project2/repo1
I'm running into trouble configuring mod_dav_svn; all I can find in the
documentation is to use SVNParentPath, but the path given must be the
direct parent of SVN repositories. I would have to supply
/srv/svn/project1 and /srv/svn/project2 in separate Location directives
to apache. The problem that I'm running into is that these project
directories are dynamically created and I need a way to configure all
potential project directories without creating a separate Location
directive for each and restarting apache.
Solutions I've tried:
#1. I tried to symlink /srv/svn/project1.repo1 to
/srv/svn/project1/repo1 (or move the repo) and use /srv/svn as
SVNParentPath. While this solution works to serve the repositories, it
changes the URL. My other repositories are served with paths like
/p/project1/repo1.git/ and I would like for SVN to follow the same
model; it wouldn't be very nice to require users to remember that SVN is
special and has a non-standard repository URL.
I've tried URL rewriting to fix the resulting URL problem, but the SVN
client sends the URL it is using to the SVN server when it does a
checkout (this is a REPORT request, with
<S:src-path>http://original-url/</S:src-path>). The SVN server responds
with a 500 error: "Unusable URI: it does not refer to this repository"
after getting most of the way through the checkout. Viewing the
repository in a browser seems to work fine, because the browser doesn't
send the URL as data. I *could* fix this by rewriting the request body,
but that seems like a terrible idea to me.
#2. I tried to find an apache configuration trick that would allow me to
set the SVNParentPath for all projects. This concept is best demonstrated:
<LocationMatch "/(\w+)/">
DAV svn
SVNParentPath /srv/svn/$1
SVNListParentPath on
</LocationMatch>
The problem with this, besides the fact that I'm not sure if \w would
work, is that I don't know of a way that I can use the matched content
in the SVNParentPath. In fact, it seems that the SVNParentPath must be
a static directory. Another thing that would work is a "here" option
for SVNParentPath/SVNPath, that would take the current directory and use
it for the path:
<DirectoryMatch "/srv/svn/\w+/">
DAV svn
SVNParentPath here
SVNListParentPath on
</DirectoryMatch>
If apache config magic like this exists, I haven't found it yet. Does
anyone on this list know a way to serve these repositories? Is there a
good way to configure apache and set SVNParentPath dynamically for each
project directory like I've attempted in solution #2? Is there a
configuration setting to turn off the URL check I'm hitting in solution #1?
I'm also open to the idea of contributing a patch for mod_dav_svn to do
this, if that is what is necessary. It seems like a good solution would
be to add a SVNSearchParentPath option that causes mod_dav_svn to check
each directory in the path until it finds a valid repository, i.e.,
contains a 'format' file with a valid format code.
Thanks for the help,
rb
Received on 2011-08-09 19:00:22 CEST