Mercurial > hg
diff doc/hgrc.5.txt @ 11330:713ae78bb583
provide pre- and post- hooks with parsed command line arguments.
python hooks are passed two new keyword arguments:
- opts: a dict of options; unsepcified options are set to their default
- pats: a list of arguments
shell hooks receive two new variables containing string representations
of the above data:
- $HG_OPTS
- $HG_PATS
for example, the opts and pats for 'hg -f v1.1' would be:
{'force': True, 'message': '', 'rev': '', 'user': '', 'date': '', 'local': None, 'remove': None, 'mq': None}
['v1.1']
author | Chad Dombrova <chadrik@gmail.com> |
---|---|
date | Thu, 10 Jun 2010 09:32:19 -0700 |
parents | ccfd1cbc7289 |
children | a86fd45c1911 |
line wrap: on
line diff
--- a/doc/hgrc.5.txt Wed Jun 09 16:25:28 2010 -0500 +++ b/doc/hgrc.5.txt Thu Jun 10 09:32:19 2010 -0700 @@ -570,11 +570,19 @@ ``post-<command>`` Run after successful invocations of the associated command. The contents of the command line are passed as ``$HG_ARGS`` and the result - code in ``$HG_RESULT``. Hook failure is ignored. + code in ``$HG_RESULT``. Parsed command line arguments are passed as + ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of + the python data internally passed to <command>. ``$HG_OPTS`` is a + dictionary of options (with unspecified options set to their defaults). + ``$HG_PATS`` is a list of arguments. Hook failure is ignored. ``pre-<command>`` Run before executing the associated command. The contents of the - command line are passed as ``$HG_ARGS``. If the hook returns failure, - the command doesn't execute and Mercurial returns the failure + 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 <command>. ``$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. ``prechangegroup`` Run before a changegroup is added via push, pull or unbundle. Exit