Hooks

Subversion has hooks - short pieces of code to run during activity in your repository. More about hooks can be found here.

Hooks can be controlled through the Hooks section of the Settings tab for your repository.

hook settings

Each hook's setting is a yaml list of individual hook scripts:

-
    script:
        echo Hello world
-
    source:
        /trunk/myhooks/checkin.py

The scripts are run with the parameters given in the Subversion hooke reference. When a script returns with an error the hook returns with that error.

Defining your hook scripts

script:

A bash script to run.

source:

  • A script file to run. This can be in your repository:

    /trunk/myhooks/checkin.py

  • in a public repository or any one you can read:

    svnplace_hooks/tags/1.1/disallow_blank_message

    or

    svn:svnplace_hooks/tags/1.1/disallow_blank_message

  • from a git repository:

    git:USER@SERVER:PROJECT_NAME.git BRANCH FILEPATH

  • from somewhere on the web

    https://mysite.com/some/file/there

When checked out from a repository, it can be a directory of resources. In that directory, the file script is run for the hook.