#pragma section-numbers 2 ## page was renamed from CommitHook = Hooks = Basic information about hooks <> == Hook return values == Hooks can be implemented as either external programs, or internal Python calls. The meaning of the return value in both cases is based on the convention for external executables: a value of 0 means "success". For hooks implemented in Python this can be a bit misleading, since it means you return "False" to indicate success and "True" (or raise an exception) to indicate failure. == Commit Hook == You can use the hook feature to, for example, automatically send mail when a commit occurs. Add the following to .hg/hgrc: {{{ [hooks] commit = commithook }}} And put this in a file called "commithook" in your path: {{{ #!/bin/sh SUBJECT=$(hg log -r $HG_NODE --template '{desc|firstline}') hg log -vpr $HG_NODE | mail -s "commit: $SUBJECT" commit-list@example.com }}} And something like this can be used for closing bugs in Roundup: {{{ #!/bin/sh ISSUE=`hg log -vr $HG_NODE | grep -o "\