<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">
<sect1 id="tsvn-repository-hooks">
	<title>Server side hook scripts</title>
	<indexterm>
		<primary>hooks</primary>
	</indexterm>
	<indexterm>
		<primary>hook scripts</primary>
	</indexterm>
	<indexterm>
		<primary>server side hook scripts</primary>
	</indexterm>
	<para>
		A hook script 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 output or return status, the hook
		program may continue the action, stop it, or suspend it in
		some way. Please refer to the chapter on
		<ulink url="http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks">
			<citetitle>Hook Scripts</citetitle>
		</ulink>
		in the Git Book for full details about the hooks which
		are implemented. 
	</para>
	<para>
		These hook scripts are executed by the server that hosts the
		repository. TortoiseGit also allows you to configure client side 
		hook scripts that are executed locally upon certain events. See
		<xref linkend="tsvn-dug-settings-hooks"/> for more information.
	</para>
	<para>
		Sample hook scripts can be found in the <filename>hooks</filename>
		directory of the repository. These sample scripts are suitable
		for Unix/Linux servers but need to be modified if your server is
		Windows based. The hook can be a batch file or an executable.
		The sample below shows a batch file which might be used to
		implement a pre-revprop-change hook.
<screen>
rem Only allow log messages to be changed.
if "%4" == "svn:log" exit 0
echo Property '%4' cannot be changed &gt;&amp;2
exit 1
</screen>
		Note that anything sent to stdout is discarded. if you want
		a message to appear in the Commit Reject dialog you must
		send it to stderr. In a batch file this is achieved using
		<filename>&gt;&amp;2</filename>
	</para>
</sect1>
