Version 14 (modified by Jeff Hammel, 8 years ago) (diff)


turn repository hooks into pluggable extension points


The RepositoryHookSystemPlugin is designed to turn repository hooks, such as SVN's post-commit hook, into extension points so that arbitrary trac plugins may be built that have full access to the trac framework to act on repository commits.

  • the RepositoryHookSystemPlugin is able to enable and disable its presence in the SVN hooks directory without affecting other plugins
  • has a webadmin interface for configuring hooks including figuring out whether or not the plugin has been enabled on a per-project basis
  • plugins can be enabled on a per-hook basis
  • the listeners are invoked via a command-line call from one of the repository hooks. This is a one-line command that passes whatever details are necessary to identify the changeset.
  • a trac changeset object is used to pass around information. This is good, as it avoids unneccessary information to be sought by the RepositoryChangeListeners. For the SvnChangeListenerPlugin (at least as it stands living only in the post-commit hook), this is sufficient. It is unknown whether this is a good idea for other hooks and repository systems. A changeset object can be faked if it is not available (like it is at SVN post-commit).
  • the logic of the RepositoryChangeListeners is agnostic to SCM type and hook used.

Architecture of the RepositoryHookSystemPlugin:


This is similar in concept to the SvnChangeListenerPlugin, but the architecture is also designed to support

  • arbitrary version control systems, with an adapter for the version control system used to an implementation capable of hook invocation
  • arbitrary hooks, not just post-commit

However, while architected to be arbitrary, this plugin has only been implemented for SVN.

Bugs/Feature Requests

Existing bugs and feature requests for RepositoryHookSystemPlugin are here.

If you have any issues, create a new ticket.


Download the zipped source from [download:repositoryhooksystemplugin here].


You can check out RepositoryHookSystemPlugin from here using Subversion, or browse the source with Trac.


Screenshot of the RepositoryHookSystemPlugin webadmin interface for configuration of an SVN post-commit hook:

webadmin interface for the SVN post-commit hook for RepositoryHookSystemPlugin

Example of an SVN post-commit hook file generated by the RepositoryHookSystem that invokes the listener:


# trac repository hook system
/home/jhammel/20080519133401/bin/python /home/jhammel/20080519133401/src/RepositoryHookSystem/repository_hook_system/ -p /home/jhammel/20080519133401/projects/fooocracy -p /home/jhammel/20080519133401/projects/newproj --hook post-commit $2

Recent Changes

7102 by k0s on 2009-11-06 21:03:12
fix comments
7099 by k0s on 2009-11-06 16:51:55
use a blank for the default as ListOption will turn this into an empty list
6999 by k0s on 2009-11-02 16:52:26
wrap file mode operations in try except, fixes #6135


Originally developed at The Open Planning Project

Author: k0s

Attachments (1)

Download all attachments as: .zip