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.
Ukazne datoteke akcij izvede strežnik, ki gosti skladišče. TortoiseSVN pa vam omogoča, da nastavite ukazne datoteke akcij na strani odjemalca. Te datoteke se izvedejo krajevno ob določenih dogodkih. Za več informacij poglejte “Ukazne datoteke akcij na strani odjemalca”.
Primere ukaznih datotek akcij najdete v podmapi hooks skladišča. Ti primeri so narejeni za sisteme Unix/Linux, tako da jih morate prilagoditi, če uporabljate strežnik s sistemom Windows. Akcija je lahko paketna datoteka ali izvršna datoteka. Spodnji primer prikazuje skripto, ki jo lahko uporabite kot akcijo pre-revprop-change.
rem Dovoli samo spremembe sporočil dnevniških zapisov. if "%4" == "svn:log" exit 0 echo Lastnosti '%4' ne morete spremeniti >&2 exit 1
Upoštevajte, da se sporočila, ki jih pošljete na standardni izhod (stdout), ne prikažejo. Če želite, da se besedilo prikaže v oknu Objava zavrnjena, ga morate poslati na stderr. V sistemski skripti to dosežete z uporabo niza >&2 na koncu sporočila.
If a hook script rejects your commit then its decision is final. But you can build an override mechanism into the script itself using the Magic Word technique. If the script wants to reject the operation it first scans the log message for a special pass phrase, either a fixed phrase or perhaps the filename with a prefix. If it finds the magic word then it allows the commit to proceed. If the phrase is not found then it can block the commit with a message like “You didn't say the magic word” :-)