Overriding commands in plugins
Martin Pool
mbp at canonical.com
Tue Mar 9 06:42:45 GMT 2010
On 9 March 2010 04:06, Gary van der Merwe <garyvdm at gmail.com> wrote:
> On 08/03/2010 17:18, Michael Gliwinski wrote:
>> What is the best/proper/right/working way to override some functionality of a
>> command in a plugin?
>
> I looked into this in detail when trying to solve the incompatibility
> between qbzr and bzr-pipeline which were both trying to modify the merge
> command. I came to the conclusion that it's not possible to do cleanly
> with how bzr currently is. I started making changes to bzr to make this
> possible[1], but ran out of motivation, and qbzr ended up losing some
> functionality (merge --qpreview)
>
> [1]:
> https://code.launchpad.net/~garyvdm/bzr/register_lazy_decorated/+merge/8430
The easiest way is to override the plugin altogether and super-call it.
The best way is to (ask for help to) change the command so that it can
more easily be extended in different directions; this is the only
feasible way to accommodate different plugins all wanting to enhance
eg the merge command.
In your example of printing a message before switching, we might add
a hook run before switching the working tree, or perhaps we should
make it always send a notification to the ui and you can tweak how
that is displayed. Was that actually what you wanted or is there a
more real example?
--
Martin <http://launchpad.net/~mbp/>
More information about the bazaar
mailing list