Automatic hook configuration for multiple Mercurial repositories
Can be configured in any hgrc (system, user, repo) and trigger for a push (pretxnchangegroup) into any repository that 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 repos List of repository names <reponame>.path Path to the repository named <reponame> <reponame>.tests Tests to run for the repository named <reponame>
Custom hooks are expected to take five arguments (check the example hook):
repo - hg repo object from hgapi user - username start - first revision (number) pushed end - last revision pushed
[hooks] pretxnchangegroup = python:path/to/autohook/autohook.py:hook [autohook] debug=True loadpath=/path/to/hooks loadmodules=hookmodule1 hookmodule2 tests = adds_branch hookmodule1.myhook repos = orig orig.path = /path/to/repo orig.tests = has_multiple_heads hookmodule2.hook
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.