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.
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:
svn client, version 1.2 or better.
cgi-bin actions for the viewer.As a quick reference, the following URL's are relevant as far as obtaining the Easy SVN Browser is concerned:
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.
Follow these steps for a quick installation of the Easy SVN Browser:
www).
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.
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.
/Users/e/src/e). Obtain the latest web-svn-view sources
using svn co svn://svn.e-tunity.com/web-svn-view.
cgi-bin/web-svn-view and modify the
configuration variables at the top of the file. The variables
are documented in the script.
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.)
http://yoursite/svnbin/web-svn-view.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?)
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.
icon defines the look of <td> elements on
the left side of tables, where the icons are shown. The
background is set to white to accomodate pictures.
small is for small-text display on <td>
elements, like diff output.
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:
svn_root must obviously point to your SVN repository.
svn_title appears as the <title> element of
output. Change this to your likings.
svn_cachedir and svn_cachetimeout control how the script
caches results. By default web-svn-view will cache
screens. This is especially useful for lengthy diff
output. If you don't want caching, comment out the settings.
If you do use caching, then intermediate results will be
stored in the cachedir. When the results become obsolete,
the script web-svn-view deletes them. Therefore, there is
no need for e.g. a cron-driven cleanup script.
svn_files_to_render is an array of regular
expressions that are used to match filenames. When a match is
found, then web-svn-view will try to render the file
inside the browser. When the match is not made, then the file
contents are displayed in a <pre> block. Typical files to
render in the browser are images.
svn_baseurl, svn_filesurl and svn_cssurl
are used when generating output. The values must correspond to
the settings in your httpd.conf.
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:
cgi-bin directory is defined, always
mapping to the same physical instance of the web-svn-view
script. However, per different location, the following values
are specifically overridden:
SVN_TITLE, the repository title
SVN_ROOT, the repository root
SVN_HIDE_URL, whether or not to hide the
repository URL from generated views
SVN_CACHEDIR and SVN_CACHEURL,
caching-related settings
SVN_BASEURL, the URL of the cgi-bin script as the
browser sees it.
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>
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: