Svn – Split svn repositories

apache-2.2svn

I'm running Subversion 1.6 on Apache 2.2 on FreeBSD 7.2.

Our Apache/SVN server is set so that when we visit http://svn.example.gov/ we get a list of repositories. Here's an example configuration, for brevity. The actual configuration involves LDAP, but hopefully that won't matter.

# All users can access this directory 
<Location />
DAV svn
SVNParentPath /data/svn
# list all repos under /data/svn
SVNListParentPath on

SSLRequireSSL

AuthName "Use your work password"
AUthType Basic
AuthUserFile /etc/apache22/htpasswd

Require User admin customer1 customer2
</Location>

I'd like to split this into three views. One for '/' (For administrative staff), one for '/repo1' (For customer1) and one for '/repo2' (for customer2), like the following. However, when I try this I get the following errors:

  • Client side. This error is false, because I don't have an existing working copy. I am trying to check out a new working copy:

    $ svn co https://svn.example.gov/repo1/
    svn: Repository moved permanently to 'https://svn.example.gov/repo1/'; please relocate
    
  • Server side:

    Jul  6 17:47:51 svn httpd[98216]: [error] [client 10.10.10.176] Could not fetch resource information.  [301, #0]
    Jul  6 17:47:51 svn httpd[98216]: [error] [client 10.10.10.176] (2)No such file or directory: Requests for a collection must have a trailing slash on the URI.  [301, #0]
    

Here's my new example config:

# All users can access this directory 
<Location />
DAV svn
SVNParentPath /data/svn
# list all repos under /data/svn
SVNListParentPath on

SSLRequireSSL

AuthName "Use your work password"
AUthType Basic
AuthUserFile /etc/apache22/htpasswd

Require User admin
</Location>

# Only customer1 can access this repo
<Location /repo1>
DAV svn
SVNPath /data/svn/repo1

Require User customer1
</Location>

# Only customer2 can access this repo
<Location /repo2>
DAV svn
SVNPath /data/svn/repo2

SSLRequireSSL

Require User customer2
</Location>

Best Answer

Both the <Location /> and <Location /repo1> sections apply to the /repo1 URI path, and so they are both processed in order. See http://httpd.apache.org/docs/2.2/sections.html.

So you're repeating some directives, and I bet they're not all happy with that. In particular:

In a configuration block for a Subversion repository, either [SVNPath] or SVNParentPath must be present, but not both.

http://svnbook.red-bean.com/en/1.5/svn.ref.mod_dav_svn.conf.html

You have both applying to /repo1.

I'm also not sure how multiple Require directives behaves, and a quick scan of the docs doesn't enlighten me, but you can experiment and find out.

I suggest starting by putting the administrative view at something like /admin rather than the root, to avoid the complication of multiple <Location /> sections applying at once. Then when that's working, figure out how to factor out common directives to make a setup like the above work. (Maybe you've done this already, and then you can skip to step two.)