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

Matt Mackall mpm at selenic.com
Mon May 6 16:30:02 CDT 2013


On Mon, 2013-05-06 at 20:27 +0000, Durham Goode wrote:
> 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
> >>command.
> >> This gives extensions a place to clean up any state that lasts the
> >>entire
> >> 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.

I'm at about -0 on adding a hook for this. Perhaps the most legitimate
use of an after-every-command user-facing hook has already been
fulfilled by blackbox.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list