# autohook

Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

## 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.
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
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.

Sample config:

[hooks]
pretxnchangegroup = autohook

[autohook]


### Installation

Easy:

pip install autohook


Manual:

python setup.py install


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.

# Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.