calling other bzr commands from with a plugin

Jamie Wilkinson jaq at spacepants.org
Mon Nov 21 04:25:06 GMT 2005


This one time, at band camp, Aaron Bentley wrote:
>Jamie Wilkinson wrote:
>| What's the correct procedure for calling other Commands from within a
>| plugin?
>
>Calling other commands is almost never the right thing, because commands
>are usually intended to be user-facing, and what you want is usually
>precision, object reuse, etc.  So it's usually better to call whatever
>the command itself calls.
>
>I suppose you can call the command's run method, if you really insist.

Right, I was planning on calling run() with a bunch of arguments.

>
>| Specifically, I want to call Aaron's 'patch' command from bzrtools, but
>| without shelling out to os.system.
>
>I'd suggest invoking bzrlib.plugins.bzrtools.patch.patch().  It might
>make sense to test whether bzrtools exists, first.

Ok, cool.

It's a dirty hack I'm writing, though, so I'm not too fussed if it explodes
:)
>
>Aaron
>




More information about the bazaar mailing list