
WHY WebSVN?

WebSVN offers a view onto your subversion repositories that's been designed
to reflect the Subversion methodology. You can view the log of any file or
directory and see a list of all the files changed, added or deleted in any
given revision. You can also view the differences between 2 versions of a
file so as to see exactly what was changed in a particular revision. 

WebSVN offers the following features: 

* Easy to use interface 
* Highly customisable templating system 
* Colourisation of file listings
* Blame view
* Log message searching
* Fast browsing thanks to internal caching feature 
* Apache MultiViews support 
* RSS feed support

Since it's written using PHP, WebSVN is also very portable and easy to install.

INSTALLATION

Grab the source and stick it somewhere that your server can get to.  You
obviously need to have PHP installed and working.  Also note that WebSVN
won't currently work in safe mode, due to the need to call svnlook.

You'll also need diff (preferably the GNU version; for Windows users I'd
recommend the Cygwin version) and svnlook available.

Rename distconfig.inc as config.inc (found in the includes directory)and then
edit it as directed in the file itself.

If everything has gone well, you should be able to view your projects by
pointing your browser at the index.php file.

For those of you wishing to customise the look and feel a little, you should
read templates.txt, which explains the highly configurable template system.

Windows users - note that some of the features offered by WebSVN, when
enabled, require the use of various external programs.  They can be downloaded
from these locations:

Diff/Sed/Gzip/Tar: http://www.cygwin.com/
Enscript:      http://people.ssh.com/mtr/genscript/

ACCENTED CHARACTERS

WebSVN is designed to worked with accented characters.  To do this, it uses
the iconv function.  This may not be installed on your system.  If you aren't
getting the characters that you expect, make sure that the iconv module is
being loaded in php.ini.  Windows users will need to copy the appropriate
DLLs to the system directory (from the PHP installation directory).

CACHING

In order to return results with a reasonable speed, WebSVN caches the results
of it's requests to svnlook.  Under normal usage this works correctly since
it's not generally possible to change a revision with subversion.

That said, one case that may cause confusion is if someone changes the log
message of a given revision.  WebSVN will have cached the previous log message
and won't know that there's a new one available.  There are various solutions
to this problem:

1) Turn off caching in the config file.  This will severely impede the
   perfomance of WebSVN.

2) Change the post-revprop-change hook so that is deletes the contents of the
   cache after any change to a revision property

3) Only allow the administrator to change revision properties.  He can then
   delete the cache by hand should this occur.

COLOURISATION

You can few files with syntax colouring if you have Enscript 1.6 or higher 
installed on your system.  You'll also need Sed.

Simply set the paths in the config file and then uncomment the line:

$config->useEnscript();

MULTIVIEWS

You may choose to configure access to your repository via Apache's MultiView
system. This will enable you to access a respositoy using a url such as:

http://servername/wsvn/repname/path/in/repository

To do this you must:

- Place wsvn.php where you want to.  Normally you place it such that it's
  accessible straight after the servername, as shown above.

- Configure the parent directory of wsvn.php to use MultiViews (see Apache
  docs).

- Change config.inc to include the line $config->useMultiViews();

- Change the paths configured at the beginning of the wsvn.php script.

Now go to http://servername/wsvn/ and make sure that you get the index page.

The repname part of the URL is the name given to it in the config.inc file.
For this reason you may wish to avoid putting spaces in the name.

AUTHENTICATION AND MULTIVIEW WALK-THROUGH

You may wish to provide an authentication mechanism for WebSVN.  One obvious
solution is to protect the entire WebSVN directory with some form of Apache
authentication mechanism, but that doesn't allow for per repository
authentication.

This walkthrough gives an example of setting up per repository authentication
that's based on the same authentication requirements as you define for the 
Subversion access itself.  You'll need to be using Apache.

First, you must get the Multiviews option working.  In my set up, my Apache
directory root is set to a location on my harddrive:

DocumentRoot "D:/svnpage"

In that directory, I have WebSVN installed in a directory called websvn.
Normally WebSVN would be accessed by http://servername/websvn

wsvn.php in then copied from the WebSVN installation to the document root
directory and the variables at the beginning of the script configured as
follows (based on your own directory locations, obviously):

// Location of websvn directory via HTTP
//
// e.g.  For http://servername/websvn use /websvn
//
// Note that wsvn.php need not be in the /websvn directory (and normally isn't).
$locwebsvnhttp = "/websvn";  

// Physical location of websvn directory
$locwebsvnreal = "d:/svnpage/websvn";

Next, turn on Multiviews in the WebSVN config.inc file:

$config->useMultiViews();

Finally, Apache needs to know that you want to enable MultiViews for the root
directory.  This can be done by including this line in the directory's
.htaccess file (assuming that the appropriate AllowOverrides directive is set
up):

Options MultiViews

If all has gone well, repositories should now by accessible by
http://servername/wsvn/repname

Note the index page can be accessed through http://servername/wsvn
If you want to view the index page by http://servername/ you need to
add another directive to the .htaccess file:

DirectoryIndex wsvn.php

We are now in a position where each repository has it's own URL location.
To configure authentication we can use the same method as for controlling
access to the svn repositories themselves.  Here's an example using SSPI:

<Location /wsvn/myproj>
SVNPath C:\svn\myproj
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIDomain MYDOMAIN
SSPIOfferBasic On
AuthzSVNAccessFile c:\svn\myaccessfile.txt
Require valid-user
</Location>

Here, I protect just the 'myproj' project, now accessed using
http://servername/wsvn/myproj

To get the AuthzSVNAccessFile directive working, you have to have the SVNPath
directive pointing to the real SVN repository.  Do NOT include the DAV
directive.

The authenticaion now works as for the repository access via SVN.  Very nice!

Newer versions of subversion allow use of the SVNParentPath directive with
AuthzSVNAccessFile , making for an even nicer set up.  Here's an example:

<Location /svn>
DAV svn
SVNParentPath C:\svn
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIDomain MYDOMAIN
SSPIOfferBasic On
AuthzSVNAccessFile c:\svn\accessfile.txt
Require valid-user
</Location>		

<Location /wsvn/>
SVNParentPath C:\svn
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIDomain MYDOMAIN
SSPIOfferBasic On
AuthzSVNAccessFile c:\svn\accessfile.txt
Satisfy Any
Require valid-user
</Location>	

Note the use of the / after /wsvn/ in the location directive.  If you use
<Location /wsvn> then you won't be able to access the index.

COMMON PROBLEMS

1) On a Windows machine, this error is reported:

Warning: shell_exec(): Unable to execute

If you experience this problem, you need to give IUSR_<machinename> execute
permissions on %systemroot%\system32\cmd.exe. Under most systems, the file will
be C:\WINDOWS\system32\cmd.exe.

Right-click on the file, choose properties, and on the security tab click
the "Add" button. Add the IUSR_<machinename> user, and then select the
"read" and "read & execute" boxes.

LICENCE

GNU Public licence.
