631 |
631 |
632 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): |
632 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): |
633 # run pre-hook, and abort if it fails |
633 # run pre-hook, and abort if it fails |
634 hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs), |
634 hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs), |
635 pats=cmdpats, opts=cmdoptions) |
635 pats=cmdpats, opts=cmdoptions) |
636 ret = _runcommand(ui, options, cmd, d) |
636 try: |
637 # run post-hook, passing command result |
637 ret = _runcommand(ui, options, cmd, d) |
638 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), |
638 # run post-hook, passing command result |
639 result=ret, pats=cmdpats, opts=cmdoptions) |
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 return ret |
646 return ret |
641 |
647 |
642 def _getlocal(ui, rpath, wd=None): |
648 def _getlocal(ui, rpath, wd=None): |
643 """Return (path, local ui object) for the given target path. |
649 """Return (path, local ui object) for the given target path. |
644 |
650 |