##// END OF EJS Templates
dispatch: add fail-* family of hooks...
Jordi Gutiérrez Hermoso -
r29129:e6dfb0e4 default
parent child Browse files
Show More
@@ -633,10 +633,16 b' def runcommand(lui, repo, cmd, fullargs,'
633 633 # run pre-hook, and abort if it fails
634 634 hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs),
635 635 pats=cmdpats, opts=cmdoptions)
636 ret = _runcommand(ui, options, cmd, d)
637 # run post-hook, passing command result
638 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
639 result=ret, pats=cmdpats, opts=cmdoptions)
636 try:
637 ret = _runcommand(ui, options, cmd, d)
638 # run post-hook, passing command result
639 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
640 result=ret, pats=cmdpats, opts=cmdoptions)
641 except Exception:
642 # run failure hook and re-raise
643 hook.hook(lui, repo, "fail-%s" % cmd, False, args=" ".join(fullargs),
644 pats=cmdpats, opts=cmdoptions)
645 raise
640 646 return ret
641 647
642 648 def _getlocal(ui, rpath, wd=None):
@@ -811,6 +811,15 b' variables it is passed are listed with n'
811 811 dictionary of options (with unspecified options set to their defaults).
812 812 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
813 813
814 ``fail-<command>``
815 Run after a failed invocation of an associated command. The contents
816 of the command line are passed as ``$HG_ARGS``. Parsed command line
817 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
818 string representations of the python data internally passed to
819 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
820 options set to their defaults). ``$HG_PATS`` is a list of arguments.
821 Hook failure is ignored.
822
814 823 ``pre-<command>``
815 824 Run before executing the associated command. The contents of the
816 825 command line are passed as ``$HG_ARGS``. Parsed command line arguments
@@ -785,4 +785,14 b' outgoing:'
785 785 no changes found
786 786 [1]
787 787
788 Test fail hook
789
790 $ hg push inner --config hooks.fail-push="echo running fail-push hook"
791 pushing to inner
792 searching for changes
793 running fail-push hook
794 abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'!
795 (merge or see "hg help push" for details about pushing new heads)
796 [255]
797
788 798 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now