[[PageOutline(2-5,Contents,pullout)]] = Repository hooks as pluggable extension points This plugin turns 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. Key features: * the RepositoryHookSystemPlugin provides an extension point ([source:repositoryhooksystemplugin/0.11/repository_hook_system/interface.py IRepositoryHookSubscriber]) which may be populated with configurable hooks that have access to their trac environment * the RepositoryHookSystemPlugin is able to enable and disable its presence in the SVN hooks directory without affecting other plugins * the [http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook trac-post-commit-hook] has been converted to a configurable plugin that does ticket changes (see source:repositoryhooksystemplugin/0.11/repository_hook_system/ticketchanger.py) * 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. This is what the RepositoryHookSystemPlugin webadmin interface looks like for configuration of an SVN post-commit hook: [[Image(screenshot.png, border=2)]] Example of an SVN post-commit hook file generated by the RepositoryHookSystem that invokes the listener: {{{#!sh #!/bin/bash # trac repository hook system /home/jhammel/20080519133401/bin/python /home/jhammel/20080519133401/src/RepositoryHookSystem/repository_hook_system/listener.py -p /home/jhammel/20080519133401/projects/fooocracy -p /home/jhammel/20080519133401/projects/newproj --hook post-commit $2 }}} However, while designed to be generic, this plugin has only been implemented for SVN. '''Architecture of the RepositoryHookSystemPlugin:''' [[Image(source:repositoryhooksystemplugin/0.11/repositoryhooksystem.png)]] This is similar in concept to the SvnChangeListenerPlugin, but the architecture is also designed to support * arbitrary version control systems, with an adaptor for the version control system used to an implementation capable of hook invocation * arbitrary hooks, not just post-commit == Bugs/Feature Requests If you are getting an error about `PYTHON_EGG_CACHE` not being set, then you may need to set this in your hook. See TracPlugins#Abouthookscripts. Existing bugs and feature requests for RepositoryHookSystemPlugin are [report:9?COMPONENT=RepositoryHookSystemPlugin here]. If you have any issues, create a [/newticket?component=RepositoryHookSystemPlugin new ticket]. [[TicketQuery(component=RepositoryHookSystemPlugin&group=type,format=progress)]] == Download Download the zipped source from [export:repositoryhooksystemplugin here]. == Source You can check out RepositoryHookSystemPlugin from [/svn/repositoryhooksystemplugin here] using Subversion, or [source:repositoryhooksystemplugin browse the source] with Trac. == Installation General instructions on installing Trac plugins can be found on the [TracPlugins#InstallingaTracplugin TracPlugins] page. == Recent Changes [[ChangeLog(repositoryhooksystemplugin, 3)]] == Author/Contributors ''Originally developed at [http://topp.openplans.org The Open Planning Project]'' '''Author:''' [wiki:k0s] [[BR]] '''Maintainer:''' [[Maintainer]] [[BR]] '''Contributors:''' olemis [[BR]]