Scripts hook

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 Hook Scripts in the Subversion Book for full details about the hooks which are implemented.

These hook scripts are executed by the server that hosts the repository. TortoiseSVN also allows you to configure client side hook scripts that are executed locally upon certain events. See la section intitulée « Client Side Hook Scripts » for more information.

Des exemples de scripts hook peuvent être trouvés dans le répertoire hooks du référentiel. Ces exemples de scripts sont appropriées pour des serveurs Unix/Linux, mais doivent être modifiés si votre serveur est basé sur Windows. Le hook peut être un fichier batch ou un exécutable. L'exemple ci-dessous montre un fichier batch qui pourrait être utilisé pour mettre en oeuvre un hook de pre-revprop-change.

rem Autorise seulement les changements sur les commentaires.
if "%4" == "svn:log" exit 0
echo Property '%4' ne peut pas être modifié >&2
exit 1

Notez que tout ce qui est envoyé sur stdout est abandonné. Si vous voulez qu'un message apparaisse dans la boîte de dialogue du rejet de la livraison vous devez l'envoyer sur stderr. Dans un fichier batch, c'est réalisé en utilisant >&2