tags:

views:

27

answers:

1

Ideally I'd like an answer to the title question.

However, for my particular case, I have a Perl script that I want to run from the precommit hook and I'd like to know if Mercurial was invoked with the -A option passed to the commit command (e.g. hg commit -A) and if it wasn't, is it possible to "pass" it in at that point?

+2  A: 

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.

Ry4an
What `man` page or other docs are you getting that from?
gvkv
From the 'hgrc' man page: http://www.selenic.com/mercurial/hgrc.5.html
Ry4an