[MERGE] Show commit hook names during commit.

Martin Pool mbp at sourcefrog.net
Thu Jun 28 05:16:31 BST 2007


> I don't think so. Theres a difference between 'I called the email hook'
> and 'an email was sent'. So having it flip through them quickly is all
> thats appropriate here IMNSHO.

Fair enough - it is probably the email plugin that should be showing a
message I suppose.

(Which means, incidentally, that the commit verbosity should be
visible to it - either in the result object passed, or (more likely?)
in global state.)

> I don't think so - they are typically quite ugly or not human meaning
> full. I am not -1 on the concept, but I tried it and rather hated it.

OK, fair enough again.

> I
> guess for debugging it would be better, but perhaps -Dhooks could always
> show the repr instead ?
> (I'd need a pointer at doing -D foodoo to do
> this trivially).

eg

class LockDir:
    def _trace(self, format, *args):
        if 'lock' not in debug.debug_flags:
            return
        mutter(str(self) + ": " + (format % args))


> > How about making the name an attribute of the hook object, rather than
> > separately registered?  I suppose the problem is that the hooks are
> > typically just callables not objects and so it is ugly to set
> > attributes on them?
>
> Thats exactly it. They are callables and its a little ugly to do
> def foo(....):
>     """"""
> foo.name_for_bzr = "blah".
> bzrlib.branch.Branch.hooks.install_hook('post_commit', foo)
>
> Its the same amount of spelling though to do what I've done :).

+1 then.

-- 
Martin



More information about the bazaar mailing list