[PATCH] python plugins in BZRPATH using Command structure

Martin Pool mbp at sourcefrog.net
Thu May 12 03:38:26 BST 2005

On 11 May 2005, John A Meinel <john at arbash-meinel.com> wrote:
> mbp at sourcefrog.net wrote:
> >On 10 May 2005, John A Meinel <john at arbash-meinel.com> wrote:
> >
> >>The attached path adds support for searching the BZRPATH env variable,
> >>and finding .py, .pyc, .pyo files therein.
> >
> >My first reaction is that this is a bit too magical, but I suppose
> >it's OK.
> I'm not sure what you consider too magical, just that putting a file in
> a directory and the command shows up? (after setting BZRPATH).

My slight discomfort was at mixing files that are run as external
programs, and files that are loaded into the bzr namespace.  For
example I can imagine someone wanting to write an external plugin in
Python if they didn't want to learn the API.  I guess here they can
not have the .py prefix.

One way to avoid this would be to have a separate variable, say

> We could put them under a separate namespaces, like:
> bzr plugin myplugin ...

No, that would defeat the purpose of seamless extension.  We do need
the opposite though, 'bzr builtin commit' so that you can wrap commit
and get back to the original.

> But as abentley pointed out, doing pre/post commit hooks can be done
> with an overload script. It would basically let you customize bzr to do
b> anything you want by using plugins. python __import__ is basically the
> same as dlopen, it just has a very nice introspective api (called the
> python language).


> Well, with arch, it creates a directory structure, but since bzr is
> planning on having a plaintext changeset for emailing around, it seems
> like that same format could be used for the undo log.


> Why the name "revert". The nice thing about "undo" is that it has an
> opposite with "redo". you could say revert/redo I guess, or have some
> sort of flag for revert to say put back the things I reverted. But I
> can't figure out a nice name for that flag.

A few reasons: firstly svn and other tools call it 'revert'.  Secondly
in tla although it's called 'undo' it is not really a general undo as
we are used to in other programs, but rather it only undoes a specific
class of actions (changes to the working copy).  You can't, for
example, use undo to undo a commit, and (iirc) undo after a merge will
undo both the merge and any other changes.  More generally, in tla
undo will often fail just when you have got your tree into a wierd
state and need it most, which I think is an argument for a very simple
and reliable revert.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050512/3f8b58dc/attachment.pgp 

More information about the bazaar mailing list