
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
78
|
Chapter 5: Repository Administration
Hook Scripts
A hook is a program triggered by some repository event, such as the creation of a new
revision or the modification of an unversioned property. Each hook is handed
enough information to tell what that event is, what target(s) it’s operating on, and
the username of the person who triggered the event. Depending on the hook’s out-
put or return status, the hook program may continue the action, stop it, or suspend
it in some way.
The hooks subdirectory is, by default, filled with templates for various repository
hooks:
$ ls repos/hooks/
post-commit.tmpl pre-revprop-change.tmpl
post-revprop-change.tmpl start-commit.tmpl
pre-commit.tmpl
There is one template for each hook that the Subversion repository implements, and
by examining the contents of those template scripts, you can see what triggers each
such script to run and what data is passed to that script. Also present in many of
these templates are examples of how one might use that script, in conjunction with
other Subversion-supplied programs, to perform common useful tasks. To actually
install a working hook, you need only place some executable program or script into
the repos/hooks directory which can be executed as the name (like
start-commit or
post-commit) of the hook.
On Unix platforms, ...