[PATCH 2 of 8] dispatch: add post-command hook
Durham Goode
durham at fb.com
Mon May 6 14:36:52 CDT 2013
# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1367429782 25200
# Wed May 01 10:36:22 2013 -0700
# Node ID 4da152c208d0f853bd03781a5d7a9b9cc8716a19
# Parent 4ddd3b2b3407fe3344fd800ea11ab377a34b8ae6
dispatch: add post-command hook
This adds a 'post-command' hook after dispatch has finished with the command.
This gives extensions a place to clean up any state that lasts the entire
session.
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -541,6 +541,8 @@
# run post-hook, passing command result
hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
result=ret, pats=cmdpats, opts=cmdoptions)
+ if repo:
+ hook.hook(lui, repo, 'post-command')
return ret
def _getlocal(ui, rpath):
diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -489,6 +489,14 @@
abort: raise abort from hook
[255]
+post-command hook
+ $ echo '[hooks]' > .hg/hgrc
+ $ echo 'post-command = python:hooktests.passhook' >> .hg/hgrc
+ $ hg id
+ cb9a9f314b8b
+ hook args:
+ hooktype post-command
+
make sure --traceback works
$ echo '[hooks]' > .hg/hgrc
More information about the Mercurial-devel
mailing list