[RFC] support for plugins to implement their own log formatters

Erik Bågfors zindar at gmail.com
Sun Feb 12 20:07:51 GMT 2006


2006/2/12, John A Meinel <john at arbash-meinel.com>:
> Erik Bågfors wrote:
> >>> I don't know about set_default_formatter.  AFICT, its purpose is to
> >>> allow plugins to control the setting, but a user may have a plugin
> >>> installed without wanting to change their default.
> >> Agreed.  That was something I was unsure about as well (but forgot
> >> when I wrote the mail)
> >>
> >> Shall I remove it? I'm fine with that.
> >>
> >>> Are you doing this because you're concerned about having to set the
> >>> defaults separately for each command that uses log formatters?  I
> >>> certainly don't have a problem with a global log-formatter-default option.
> >> Sounds good. I wasn't thinking about the default thing since that's
> >> not in bzr.dev yet afaik...
> >
> > Now, you can set the default formatter in the configuration.  A plugin
> > cannot (easily) change the default formatter. Branch in the same
> > place.
> >
> > Any more comments?
> >
> > Regards,
> > Erik
>
> In one place you use:
>
> default = bzrlib.config.BranchConfig(b).log_format()
>
> in another you use:
>
> default = bzrlib.config.BranchConfig(local_branch).log_formatter()
>
> I have a feeling one of them is wrong. Which also indicates that they
> aren't both tested.

Absolutely true. I moved between calling it "log_formatter" and
"log_format" and forgot one place.

> Otherwise, I like the idea that we can have plugins register new log
> formatters. And the code is relatively clean. +1 if you add tests, and
> fix the bug.

thanks.

Then to my next question. How do I test this thing.  I can't really
test a plugin that registers a log format because test_plugins.py
states that we can't test plugins.  I don't know how to test the
--log-format option, and I can't find any test of --line or --short. 
I already have tests to show that the default log format is read
correctly from bazaar.conf. (in test_config.py)

Any help with this is appreciated.

/Erik




More information about the bazaar mailing list