Scripts gancho

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.

Estos scripts gancho se ejecutan por el servidor que hospeda el repositorio. TortoiseSVN también le permite configurar scripts ganchos del lado del cliente que se ejecutan localmente en ciertos eventos. Para más información consulte “Scripts gancho del lado del cliente”.

Puede encontrar scripts de ganchos en el directorio hooks del repositorio. Estos scripts de ejemplo son válidos para servidores Unix/Linux pero necesitan modificarse si su servidor está basado en Windows. El gancho puede ser un fichero batch o un ejecutable. El siguiente ejemplo muestra un fichero batch que puede ser usado para implementar un ganch pre-revprop-change.

rem Solo se permite cambiar mensajes de registro.
if "%4" == "svn:log" exit 0
echo No se puede cambiar la property '%4' >&2
exit 1

Tenga en cuenta que cualquier cosa que mande a la salida estándar se descartará. Si desea que aparezca un mensaje en el diálogo Confirmación Rechazada debe enviarlo a la salida de error. En un fichero batch esto se consigue usando >&2