Configuring trac

This post covers how I have configured trac, and trac svn integration, it follows on from Installing Trac and SVN on the Raspberry Pi. It is intended just as a personal reminder, but if it is helpful…

Adding SVN repository to trac

Detailed instructions can be found in TracRepositoryAdmin in the trac wiki.
You are then told to do perform the steps below
So first perform a manual sync
sudo -u www-data trac-admin /var/trac/projects/play repository resync "play"
Edit trac.ini to configure the updater.
sudo -u www-data vi /var/trac/projects/play/conf/trac.ini
In the [trac] section set repository_sync_per_request blank

repository_sync_per_request =

In /var/svn/repos/play/hooks create a file called post-commit with this content

#!/bin/sh
export PYTHON_EGG_CACHE="/tmp"
/usr/bin/trac-admin /var/trac/projects/play changeset added "$1" "$2"

In the same place create post-revprop-change with this content

#!/bin/sh
export PYTHON_EGG_CACHE="/tmp"
/usr/bin/trac-admin /var/trac/projects/play changeset modified "$1" "$2"
 
Ensure that both of these scripts are owned by www-data and that both are executable
sudo chown -R www-data:www-data post-commit post-revprop-change

sudo chmod +x post-commit post-revprop-change

 CommitTicketUpdater

Enable the CommitTicketUpdater plugin by going to the admin tab in trac and then selecting Plugins from the Administration Panel, open the Trac 0.12.5 plugin and tick CommitTicketUpdater as shown.

Edit trac.ini to configure the updater.

sudo -u www-data vi /var/trac/projects/play/conf/trac.ini

In the [ticket] section add the following

commit_ticket_update_envelope =
commit_ticket_update_commands.close =
commit_ticket_update_commands.refs = <ALL>
commit_ticket_update_check_perms = true
commit_ticket_update_notify = true

Testing Commit Hook

Having completed all of the above configuration I rebooted my RPi, I don’t know that this is required but it seemed sensible.
I then created a ticket #1 in the play project, To test I checked out the trunk for the play repository and committed a new file with the commit message “Test commit hook See #1”, the commit happened and ticket #1 was updated with the following comment

Logo

I like each trac project to be immediately identifiable so that it is obvious which trac I am working on. I just set the project logo. The logo looks best with an image of a little under 100 pixels high. I saved the files as play.png in /var/trac/projects/play/htdocs.
I then edited trac.ini (as www-data)

sudo -u www-data vi conf/trac.ini

I set the content of [header_logo]

[header_logo]
alt = play repository to test ideas
height = 80
src = site/play.png
width = 300

Related posts

Posted in Software Development and tagged , , .

Leave a Reply

Your email address will not be published. Required fields are marked *