[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: mod_dav_svn configuration

From: Nico Kadel-Garcia <nkadel_at_gmail.com>
Date: Wed, 10 Aug 2011 05:42:52 -0400

On Tue, Aug 9, 2011 at 12:59 PM, Ryan Blue <rdblue_at_gmail.com> wrote:
> 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.

This is where you run a cron job that pokes the /srv/svn file
structure for repositories, generates stanzas for each "project"
directories, creates a config file with all the stanzas, looks for
changes between this config file and the existing one in the apache
setups, updates the apache config files as necessary, and reloads
apache.

This actually turns out to be easy to do, and for for RHEL, the
subversion stanza would go in /etc/httpd/conf.d/srv-svn-projects.conf
or a similar location

> 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-10 11:43:30 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.