John A Meinel
john at arbash-meinel.com
Wed Aug 17 20:35:55 BST 2005
Aaron Bentley wrote:
> John A Meinel wrote:
>>>>Modify register_command to always replace the previous command, and not
>>>>1. scan bzrlib/commands
>>>>2. scan /usr/lib/python2.4/site-packages/bzrplugins for system-wide plugins
>>>>3. scan ~/.bzr.conf/plugins
>>>My suggestion is to have BZR_PLUGIN_PATH act more like the real path,
>>>where the first entry found is used, and all others are ignored.
>>>I was realizing that if you use plugins to implement hooks, you might
>>>want multiple levels.
> My suggestion above was to support both these goals.
> 1. Having the last command win and doing it in reverse order gives the
> same precedence as having the first command win and doing it in forward
Except that isn't how most PATH style variables work. I'm okay with your
suggestion, I was just discussing trying to maintain PATH consistencies.
> 2. By registering all commands, not just the first one found, we have
> the opportunity to determine the previously-registered command, so that
> we can wrap it.
Well, you still have to load the plugin, to know what it is doing at the
point of "register_command()". However, I will admit that you can't wrap
system plugins if you load user plugins first.
I'll give on the PATH priority. Load everything, last one loaded wins,
default path is "$BZR/bzrlib/plugins:~/.bzr.conf/plugins"
register_command() overrides previous entry, putting something in the
log rather than issuing a warning.
I don't feel the need to have a 'commands' directory, but I'm okay with
it. I don't think we need it to be scanned, we can just "import
bzrlib.commands" and have the commands/__init__.py code handle loading
and registering all of the appropriate commands. Commands seems more
built-in, so it doesn't need to be as dynamic as plugins. I'm hoping
that can make it faster, but python is pretty dynamic to start with, so
I can't really say.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050817/0a397878/attachment.pgp
More information about the bazaar