[PATCH] Search user plugin directories before site plugin directories

John Arbash Meinel john at arbash-meinel.com
Fri Feb 23 17:29:20 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> John Arbash Meinel wrote:

...

> 
> Plugins used to be loaded in order of discovery.  It appears that Robert
> has broken this by using a set.  We need to get it back, because all
> site-wide plugins should be loaded before user plugins.
> 
> e.g. if site-wide plugin "foo" overrides "diff" and user plugin plugin
> "bar" overrides "diff", then "bar" should win.  If we load user plugins
> first:
> 
> 1. "bar" is loaded
> 2. "bar" overrides the builtin diff
> 3. "foo" is loaded
> 4. "foo" overrides "bar"'s diff
> 
> But it appears we are loading plugins in random order, since we're using
> a set.  And so this patch doesn't make us any more broken than we
> already were.
> 
> Aaron

Well, this patch fixes a different problem, where site-wide plugin "foo"
is getting loaded instead of user plugin "foo".

And we can always change the import code to load in reverse discovery
order. I think the conflict is that if you set a BZR_PLUGIN_PATH plugins
earlier in the path should override plugins later in the path. So if
there is a name conflict, the first found should win. But if there are 2
plugins which do something similar, then the first found should also
win, so it needs to be loaded last.

At least, that sounds like how you and I agree on the subject. We were
just talking past each other because we were looking at different parts
of the plugin import puzzle.

I think this initial patch should be merged, and then we can fix the
"import last found non-conflicting plugin first" so that plugins get a
chance to override commands at the right time.

Actually, if you look at the "register_command()" function, if a plugin
doesn't supply "decorate=True" it won't get precedence. So actually it is:

1. "bar" is loaded
2, "bar" overrides the builtin diff
3. "foo" is loaded
4. "foo" tries to overload "bar"'s diff, but can't because diff is
   already overloaded.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF3yRwJdeBCYSNAAMRAg8DAJwIWF0Q/tN59V0WWCcmTOSKg0QrUgCgkLbq
w6Z9ks8GBMRsmY1qrzHf/bc=
=e3j3
-----END PGP SIGNATURE-----



More information about the bazaar mailing list