Easy SVN Browser (version 1.11)
A viewer for SVN repositories

Karel Kubat

e-tunity

2005 ff.

Easy SVN Browser is a cgi-bin driven viewer for SVN repositories. It is suitable for all repositories, but specifically aimed at sites where one cannot easily install specific SVN-related packages. This viewer only needs a command-line svn client and Perl. Easy SVN Browser is modelled for high-load usage: requests for the viewer are cached, so that transactions on the repository are minimized. This document is also available in PDF format.

Table of Contents

1: Introduction

1.1: Porting issues for pre-1.10 versions

2: Quick Installation

3: Tweaking

3.1: The Stylesheet
3.2: Configurations in the script
3.3: Using the same viewer for multiple repositories

4: Feedback and Comments


1: Introduction

Welcome to Easy SVN Browser, "yet another subversion repository viewer". I wrote this viewer because I needed a simple piece of software that would run almost anywhere.

The requirements to make Easy SVN Browser run on your system, are:

As a quick reference, the following URL's are relevant as far as obtaining the Easy SVN Browser is concerned:

1.1: Porting issues for pre-1.10 versions

As of version 1.10, the configuration options for images (eg. svn_imgurl) were dropped. The style sheet and all images, plus Javascript sources, are now located in a subdirectory files/. There is a corresponding configuration value svn_filesurl. Please edit your Apache configuration(s) and make the appropriate changes.

2: Quick Installation

Follow these steps for a quick installation of the Easy SVN Browser:

  1. Log in as the user who is running the webserver (e.g., www).

  2. As this user, make sure you have read-access on your repository. Issue an svn command to make sure that if necessary, you are prompted for a username and password. Once the viewer is running, logins must take place automatically. E.g., assuming that your SVN repository is on svn://localhost/home/svn, run the command svn ls svn://localhost/home/svn. This must produce output, or else something's afoot.

  3. Obtain the web-svn-view package. There are two possibilities:

    • Obtain the the archive web-svn-view-latest.tar.gz from the site http://public.e-tunity.com. Save the archive to a temporary location on your hard disk (e.g., /tmp). Change-dir to a directory where the webserver will run the viewer. Unpack, using tar xzf /tmp/web-svn-view-latest.tar.gz. Note the full paths to the contained directories cgi-bin and files. In the following example we'll assume that the base directory is /Users/e/src/e.

    • Change-dir to a directory where the webserver will run the viewer (in the next examples this is assumed as /Users/e/src/e). Obtain the latest web-svn-view sources using svn co svn://svn.e-tunity.com/web-svn-view.

  4. Edit cgi-bin/web-svn-view and modify the configuration variables at the top of the file. The variables are documented in the script.

  5. Edit the server's configuration file. E.g, for Apache, edit httpd.conf and add the following lines:

    
    DocumentRoot                /Users/e/src/e/web-svn-view
    <Location                   />
        Order                   deny,allow
        Deny from               all
    </Location>
    
    ScriptAlias                 /svnbin /Users/e/src/e/web-svn-view/cgi-bin
    <Location                   /svnbin>
        Order                   allow,deny
        Allow from              all
    </Location>
    
    Alias                       /svnfiles /Users/e/src/e/web-svn-view/files
    <Location                   /svnfiles>
        Order                   allow,deny
        Allow from              all
    </Location>
    
    Alias                       /svncache /Users/e/src/e/web-svn-view/cache
    <Location                   /svncache>
        Order                   allow,deny
        Allow from              all
    </Location>
    

    You will need to supply the right directories for your system, instead of /Users/e/src/e as in the above example. Also make sure that the HTTP user has write-access to the cache directory stated in the script web-svn/view (which must match the directory that is aliased to /svncache in httpd.conf.)

  6. Restart the webserver.

  7. Point your browser to http://yoursite/svnbin/web-svn-view.

3: Tweaking

This section describes in some depth how you can modify web-svn-view to your likings. (What good is a software package that just does what it's supposed to do, while you can't break it by fiddling 'round with the settings?)

3.1: The Stylesheet

The stylesheet css/web-svn-view.css is loaded in every screen that web-svn-view produces. If you've worked with CSS before, then this all will look familiar.

3.2: Configurations in the script

The script web-svn-view has a hash %conf at the top, where the all values are defined that control the script. The following list explains some of them:

3.3: Using the same viewer for multiple repositories

If you want to use web-svn-view to show the contents of more than one repository, then you don't have to instantiate more than one version of web-svn-view on your system. You don't even have to have more than one cgi-bin directory.

All it takes is defining multiple cgi-bin locations in your httpd.conf, and based on the repository that you want to address, overriding the right configuration values of the web-svn-view script.

Overriding the values is always done by environment variables. E.g, the configuration variable svn_root is overridden using an environment variable $SVN_ROOT. Similarly, svn_title is overridden using $SVN_TITLE and so on.

In httpd.conf, you can set such environment variables using the SetEnv directive. For example, let's assume that three viewers should be defined for three repositories. The approach is as follows:

An excerpt of such an httpd.conf is shown below.

# General
ErrorLog            /var/log/apache/svn.e-tunity.com-error.log
CustomLog           /var/log/apache/svn.e-tunity.com-access.log \ 
                    common

DocumentRoot        /home/http/svn.e-tunity.com/web-svn-view
<Location           />
    Order           allow,deny
    Allow           from all
</Location>

# Generic settings for CSS, images, and the cache root.
Alias               /svnfiles \ 
                    /home/http/svn.e-tunity.com/web-svn-view/files
Alias               /svncache \ 
                    /home/http/svn.e-tunity.com/web-svn-view/cache
<Location           /svnfiles>
    Order           allow,deny
    Allow from      all
</Location>
<Location           /svncache>
    Order           allow,deny
    Allow from      all
</Location>

# Easy SVN Viewer
ScriptAlias         /web-svn-view \ 
                    /home/http/svn.e-tunity.com/web-svn-view/cgi-bin
<Location           /web-svn-view>
    Order           allow,deny
    Allow from      all
    SetEnv          SVN_TITLE "Easy SVN Browser"
    SetEnv          SVN_ROOT  svn://svn.e-tunity.com/web-svn-view
    SetEnv          SVN_HIDE_URL 0
    SetEnv          SVN_CACHEDIR ../cache/web-svn-view
    SetEnv          SVN_BASEURL /web-svn-view/web-svn-view
    SetEnv          SVN_CACHEURL /svncache/web-svn-view
</Location>

# Crossroads
ScriptAlias         /crossroads \ 
                    /home/http/svn.e-tunity.com/web-svn-view/cgi-bin
<Location           /crossroads>
    Order           allow,deny
    Allow from      all
    SetEnv          SVN_TITLE "Crossroads Balancer"
    SetEnv          SVN_ROOT  svn://svn.e-tunity.com/crossroads
    SetEnv          SVN_HIDE_URL 0
    SetEnv          SVN_CACHEDIR ../cache/crossroads
    SetEnv          SVN_BASEURL /crossroads/web-svn-view
    SetEnv          SVN_CACHEURL /svncache/crossroads
</Location>

# e-lib
ScriptAlias         /e-lib \ 
                    /home/http/svn.e-tunity.com/web-svn-view/cgi-bin
<Location           /e-lib>
    Order           allow,deny
    Allow from      all
    SetEnv          SVN_TITLE "Utility library e-lib"
    SetEnv          SVN_ROOT  svn://svn.e-tunity.com/e-lib
    SetEnv          SVN_HIDE_URL 0
    SetEnv          SVN_CACHEDIR ../cache/e-lib
    SetEnv          SVN_BASEURL /e-lib/web-svn-view
    SetEnv          SVN_CACHEURL /svncache/e-lib
</Location>

4: Feedback and Comments

Feedback is always appreciated. I can be reached as karel@e-tunity.com. Work on this package is in progress; e.g., the command svn status can be used more effectively. Also I'm not fully satisfied with the diff output.

Nevertheless, I appreciate hearing from you. If you have bug reports, please clearly state: