You are on page 1of 4

SVN Trac Apache Subversion (SVN) Setup Installation of Subversion is a straight forward by using svn-1.4.4-setup.

p.exe Default installation directory is C:\Program Files\Subversion The following environment variable is also added:
APR_ICONV_PATH=C:\Program Files\Subversion\iconv

It is good to have C:\Program Files\Subversion in windows PATH. Trac Setup You can start using SVN with Trac. The advantage of having Trac can be summarized as follows: 1. Provides bug tracking and patch management 2. Easy comparison with different SVN revisions 3. And many more ... Trac is written in python and depends on several python libraries. The following are required to complete trac installation: python-2.4.4.msi clearsilver-0.9.14.win32-py2.4.exe pysqlite-2.3.4.win32-py2.4.exe svn-python-1.4.4.win32-py2.4.exe trac-0.10.4.win32.exe
Some scripts need modifications post installation. Installed in C:\Python24 (Custom installation)

The python.ex executable path should be updated in the following files:

C:\Python24\Scripts\ C:\Python24\Scripts\ C:\Python24\share\trac\cgi-bin\trac.cgi C:\Python24\share\trac\cgi-bin\trac.fcgi #!C:\Programme\python... (1st line) change it to #!C:\Python24\python.exe

[Append C:\Python24 (python installation directory) to PATH environment variable to easily invoke python] Convention I have the following conventions for the repository management: 1. 2. 3. 4. 5. Main project will have a independent svn repository. Each project svn has its own trac setup. Project addons will be under the same svn. All the svn repository are under one main directory (C:\var\svn) All the trac setup for the svn are under one directory (C:\var\trac)

These convention will come handy when you want to backup the svn/trac or when you need to move these to different system.


SVN & Trac for a project DocManager

Detailed below is the steps required in creating svn and trac for the project DocManager at start.
C:\var>svnadmin create svn\DocManager C:\var>python.exe c:\Python24\Scripts\ trac\DocManager initenv Creating a new Trac environment at C:\var\trac\DocManager Trac will first ask a few questions about your environment in order to initalize and prepare the project database. Please enter the name of your project. This name will be used in page titles and descriptions. Project Name [My Project]> DocManager Please specify the connection string for the database to use. By default, a local SQLite database is created in the environment directory. It is also possible to use an already existing PostgreSQL database (check the Trac documentation for the exact connection string syntax). Database connection string [sqlite:db/trac.db]> Please specify the type of version control system, By default, it will be svn. If you don't want to use Trac with version control integration, choose the default here and don't specify a repository directory. in the next question. Repository type [svn]> Please specify the absolute path to the version control repository, or leave it blank to use Trac without a repository. You can also set the repository location later. Path to repository [/path/to/repos]> c:\var\svn\DocManager Please enter location of Trac page templates. Default is the location of the site-wide templates installed with Trac. Templates directory [E:\programs\python24\share\trac\templates]> ... Prasad

Enable http access The advantange of svn and trac can be taken once you enable http access through Apache. You need the following in your httpd.conf:
LoadModule dav_svn_module "C:/Program Files/Subversion/bin/" LoadModule authz_svn_module "C:/Program Files/Subversion/bin/" ################## # For DocManager # ################## <Location "/svn/docmanager"> DAV svn SVNPath c:/var/svn/DocManager </Location> ScriptAlias /trac/docmanager c:\Python24\share\trac\cgi-bin\trac.cgi <Directory "c:/Python24/share/trac/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all Options Indexes FollowSymLinks ExecCGI </Directory> <Location "/trac/docmanager"> SetEnv TRAC_ENV "c:/var/trac/DocManager" </Location>

NOTE: For each svn and trac setup, this section needs to be replicated making changes in highlighted place suitably. Controlled http access Using htpasswd you can create login for users and take advantage of apache's login authentication for svn and trac together. In which case the following changes is required to Location setup in httpd.conf
<Location "/svn/docmanager"> DAV svn SVNPath c:/var/svn/DocManager AuthType Basic AuthName "SVN" AuthUserFile c:/var/svn.htpasswd Require valid-user </Location> <Location "/trac/docmanager"> SetEnv TRAC_ENV "c:/var/trac/DocManager" AuthType Basic AuthName "Trac" AuthUserFile c:/var/svn.htpasswd Require valid-user </Location>

Creating valid-users:
C:\var>c:\apache2\bin\htpasswd.exe svn.htpasswd username password

NOTE: You can setup the authentication for the location /svn and /trac instead of /svn/docmanager and /trac/documanger. If you create svn and trac for many projects, this will be very useful.

SVN Usage After enabling http access (with or without access control) it becomes very easy to work with svn. Given below are with respect to DocManager project.
C:\Projects>svn import -m Initial Import docmgr_proto http://localhost/svn/docmanager/trunk C:\Projects>svn mkdir -m creating svn tags dir http://localhost/svn/docmanager/tags C:\Projects>svn copy -m tagging base version http://localhost/svn/docmanager/trunk http://localhost/svn/docmanager/tags/VER00 C:\Projects>svn co http://localhost/svn/docmanager/trunk docmanager_work C:\Projects>cd docmanager_work Make changes to project files. C:\Projects\docmanager_work>svn commit -m added some new feature C:\Projects\docmanager_work>svn update C:\Projects\docmanager_work>svn mkdir -m creating svn branches dir http://localhost/svn/docmanager/branches C:\Projects\docmanager_work>svn copy -m creating branch for new feature http://localhost/svn/docmanager/trunk http://localhost/svn/docmanager/branches/newfeature [Refer svn redbook for more documentation on SVN usage and administration]

Tortoise On windows Tortoise is a very popular GUI tool to work with CVS or SVN (other than IDE's like Eclipse). Tortoise installation is very easy with TortoiseSVN-
NOTE: Tortoise creates a separate process (TSVNCache) to check the provide overlay icons to indicate the file status. When you browse using windows explorer the process can be costly as it eats memory. It is better to turn-off icon overlays for indivdual files. This can be done as follows: Right click in windows folder. TortoiseSVN -> Settings -> Look and Feel -> Icon Overlays Status Cache: None No status cache. Only versioned folders get an overlay, files don't get an overlay.