Automatic hook configuration for multiple Mercurial repositories
Can be configured in any hgrc (system, user, repo) and trigger for any hook into any repository which uses that hgrc. Can load external (Python) hooks that needs to accept parameters repo, user, start revison, end revision
Contains two built-in hooks, adds_branch and has_multiple_heads, and users that can bypass hooks can be defined. Depends on hgapi (https://bitbucket.org/haard/hgapi).
Configuration variables under the [autohook] group:
debug More verbose. loadpath Path to add to system path before trying to load modules from loadmodules loadmodules Modules to load before running hooks tests List of tests to run for all repositories superuser List of users who are allowed to bypass tests selective If set to true, only run for repositorys defined in ``repos`` and with a valid path set through ``<reponame>.path`` repos List of repository names <reponame>.path Path to the repository named <reponame> <reponame>.tests Tests to run for the repository named <reponame> (in addition to global)
Custom hooks are expected to take four arguments:
repo - hg repo object from hgapi user - username start - first revision (number) pushed end - last revision pushed
Hooks should return zero on success (if pretxn*-hook). Check autohook.autohook.example_hook for an example.
[hooks] pretxnchangegroup = autohook [autohook] loadpath=/path/to/hooks loadmodules=hookmodule tests = adds_branch hookmodule.myhook
pip install autohook
python setup.py install
Copyright (c) 2011, Fredrik Håård
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.