[merge] accept LogFormatter instances in cmd_log.run

John Arbash Meinel john at arbash-meinel.com
Fri Jul 28 16:24:55 BST 2006


Adeodato Simó wrote:
> 
>> In general, you shouldn't be calling cmd_log.run.
> 
> Hm. "I", as in "a plugin", shouldn't be calling cmd_log.run ?
> 
>> The purpose of that function is to decode commandline parameters and
>> invoke the underlying functionality, i.e. show_log.  (Which *does*
>> accept a log formatter, of course.)
> 
> Yes, but that decoding has a lot of logic that a wrapper plugin may not
> want to duplicate. I know wrappeability is crucial for me (*), and I can't
> see that providing it for those who _want_ to use it is a bad thing?
> 
>   (*) Either because is the easiest way to code a plugin, or because I'm
>       unable to find another more elgant or proper way to do it. Consider 
>       for example cmd_logdiff.py [1], which is what prompted me to propose
>       this change.
> 
> Cheers,

In general the Command classes are just meant to decode command line
arguments, and then call into a real bzrlib class.

If there is a lot of logic inside a Command.run function, that is an
indication that it needs to be refactored into more of a helper function.

> 
> References:
> 
>   [1] http://people.debian.org/~adeodato/code/bzr/plugins/private/adeodato/cmd_logdiff.py
> 

I think you could use 'bzrlib.diff.show_diff_trees' coupled with
'bzrlib.log.show_log()' to do most of what you needed.

I do realize you wanted to re-use the argument parsers from the other
commands. But I have the feeling it doesn't make 'bzr logdiff'
friendlier, but more of a frankenstein. (not that it isn't useful).

I'm guessing much more useful for either of this would be just a custom
log formatter that when given --verbose, instead of just printing out
the short-summary of the delta, it would print out the full diff.

If you look at LogFormatter.show() it is already getting the computed
delta. (if --verbose is set)

Probably we have a deficiency where the LogFormatter should also be
getting a reference to a Repository, where it can get more information
about a given delta....

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060728/59720a31/attachment.pgp 


More information about the bazaar mailing list