[PATCH 2 of 8] dispatch: add post-command hook

Durham Goode durham at fb.com
Mon May 6 15:27:13 CDT 2013

On 5/6/13 12:56 PM, "Matt Mackall" <mpm at selenic.com> wrote:

>On Mon, 2013-05-06 at 12:36 -0700, Durham Goode wrote:
>> # 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
>> This gives extensions a place to clean up any state that lasts the
>> session.
>How is this different than the existing post-* hooks?
>How does this work with the command server, where a session lasts longer
>than a command?

The difference is that this hook fires for every command.  In my scenario
a network connection is opened when there is a cache miss and the
connection is kept open until this hook is fired.  There isn't one
particular command that I could subscribe to in this case.

For the command server, this hook will fire after every command.  That's
fine in my case, since I'd probably want the network connection to close
after each command anyway.

I could achieve this in the extension by wrapping dispatch.runcommand (so
this hook is not absolutely necessary), but it seemed like a globally
useful hook to have.

More information about the Mercurial-devel mailing list