RFC/discuss get_missing_command fires too often
Robert Collins
robertc at robertcollins.net
Mon Jul 13 03:16:31 BST 2009
On Mon, 2009-07-13 at 11:59 +1000, Martin Pool wrote:
> > In the above paragraph I mean that _get_plugin_command should check
> > whether an existing command had been found (command lookup works as a
> > pipeline). If one was found and there is a registered plugin command of
> > the same name, it should *at that point* perform the policy check for
> > 'are we overriding' - rather than doing it at the 'register_command'
> > step.
>
> I wonder if it should pass the previously-found, typically builtin
> command to the constructor of the plugin command, so that it can
> either complain or decorate it. That would be a way around the
> problem of plugins, which often want to do decoration, forcing the
> builtin commands to be loaded. Or maybe there's already some solution
> for this?
Thats what happens now, I think. Maybe I don't get quite what you mean.
There are two separate things that happen.
One thing is that _get_bzr_command, which is called by the
get_command_hook, only knows how to scan an entire module
(bzrlib.builtins), rather than just doing e.g. getattr(bzrlib.builtins,
'cmd_%s' % name, None) to get the command class. One of the problems
with trying to change this is how way aliases are defined and maintained
- we can't predict what command we need until we introspect potentially
all the builtins.
The other thing, is that get_cmd_object, which invokes the get_command
hook, calls all the hook callbacks in series, piping the output of the
first into the second, and so on.
So if we change the _get_bzr_command to do less work, the interface
doesn't need to change - we'd still ask _get_bzr_command for the
specific command, but that could potentially load a single command, and
fail cleanly in that commands absence.
-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090713/882c4f19/attachment.pgp
More information about the bazaar
mailing list