What are local hooks for in TortoiseSVN?

3.3k Views Asked by At

I just realized that TSVN supports local hooks.

Can someone explain what they can be useful for?

I already use server-side hooks to enforce entering log message for commits and prevent certain files from being checked in; also use post-commit hooks to send emails on commits.

We also use AnkhSVN and my understanding is that it has no support for local hooks, is that correct?

1

There are 1 best solutions below

0
On

This is explained fairly thoroughly in the Tortoise SVN help file (right-click, Tortoise SVN->Help, and search for Hooks in the index; there's a link directly to 4.30.8. Client Side Hook Scripts, which says in part (see in particular the first two paragraphs):

This dialog allows you to set up hook scripts which will be executed automatically when certain Subversion actions are performed. As opposed to the hook scripts explained in Section 3.3, “Server side hook scripts”, these scripts are executed locally on the client.

One application for such hooks might be to call a program like SubWCRev.exe to update version numbers after a commit, and perhaps to trigger a rebuild.

For various security and implementation reasons, hook scripts are defined locally on a machine, rather than as project properties. You define what happens, no matter what someone else commits to the repository. Of course you can always choose to call a script which is itself under version control.

It goes on to say there are currently six types of hooks supported (as of TSVN v1.6.15 64-bit):

There are currently six types of hook script available

  • Start-commit
  • Pre-commit
  • Post-commit
  • Start-update
  • Pre-update
  • Post-update