According to the Trac wiki:
Prior to 0.12, Trac synchronized its cache with the repository on every HTTP request. This approach is not very efficient and not practical anymore with multiple repositories. For this reason, explicit synchronization through post-commit hooks was added.
The preferred method of repository synchronization is explicit synchronization. We’ll see how to enable it.
The first thing is to edit trac.ini:
$ sudoedit /var/trac/conf/trac.ini
And set the repository_sync_per_request option (it can be found in the [trac] section) to an empty value:
[trac] ... repository_sync_per_request = ...
Now we need to add a call to trac-admin in the post-commit hook of each repository.
For example, with a repository located in /var/svn/project1, the post-commit hook is located at /var/svn/project1/hooks/post-commit:
$ sudoedit /var/svn/project1/hooks/post-commit
This is how this file should look like:
#!/bin/sh TRAC_ENV="/var/trac" TRAC_ADMIN=$(which trac-admin) $TRAC_ADMIN "$TRAC_ENV" changeset added "$1" "$2"
Then change the ownership and permissions of this file:
$ sudo chown www-data:www-data post-commit $ sudo chmod ug+x post-commit
Additionally, if a repository allows changing revision metadata, a call to trac-admin must be added to the post-revprop-change hook as well:
$ sudoedit /var/svn/project1/hooks/post-revprop-change
This is how this file should look like:
#!/bin/sh TRAC_ENV="/var/trac" TRAC_ADMIN=$(which trac-admin) $TRAC_ADMIN "$TRAC_ENV" changeset modified "$1" "$2"
Then change the ownership and permissions of this file:
$ sudo chown www-data:www-data post-revprop-change $ sudo chmod ug+x post-revprop-change
Add your comment below, or trackback from your own site.
Subscribe to these comments.
Be nice. Keep it clean. Stay on topic. No spam.
You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">