This is going to seem a little silly, but in addition to the precommit
hook, there's a pre-XXXX (and post-XXXX) hook for every command, which gets some different variables:
pre-<command>
Run before executing the associated
command. The contents of the command
line are passed as $HG_ARGS. Parsed
command line arguments are passed as
$HG_PATS and $HG_OPTS. These contain
string representations of the data
internally passed to .
$HG_OPTS is a dictionary of options
(with unspecified options set to their
defaults). $HG_PATS is a list of
arguments. If the hook returns
failure, the command doesn't execute
and Mercurial returns the failure
code.
So do a pre-commit
hook instead and check those variables.