status command and output styles

Martin Pool mbp at canonical.com
Thu Feb 25 23:21:53 GMT 2010


On 26 February 2010 08:31, Russ Brown <pickscrape at gmail.com> wrote:
> On Thursday 25 February 2010 12:33:39 am Martin Pool wrote:
>> On 24 February 2010 09:51, arnaud jeansen <arnaud.jeansen at gmail.com> wrote:
>> > Would it make sense to abstract out the output formatting for status ? I
>> > imagine it could be possible to create a new class (OutputFormat,
>> > OutputTemplate, whatever) and
>> > - pass the OutputFormat in a TreeDelta.show() (visitor pattern),
>> > - or move the show() logic to OutputFormat and have it wrap a TreeDelta,
>> > - or something else
>>
>> Yes, it would be good to abstract it more.  Ian and Vincent have
>> recently done some things here and could probably mentor you.
>
> Just to interject an aside here, but quite a while back I was looking at ways
> to improve how bzr-diffstat works: it currently parses the raw text output by
> diff and calculates its statistics based on that. It would obviously be far
> more efficient to be able to access the raw diff data itself (in whatever form
> that takes) and generate statistics from that. Currently, bzr spends time
> formatting a textual diff that is never going to be displayed, which is
> obviously a waste of effort.
>
> I remember asking about it at the time but I don't think the required
> information was available. Any idea how difficult it would be to expose that
> detail for use in situations like this?

In 2a we don't store a line-based delta, so we are going to have to
extract the texts and diff them.  However, we could avoid actually
formatting it into a diff and then reparsing that.  Basically what you
would want to do is look down through the diff code til you find the
place where it's just generating a sequence of line-based updates,
then call that code instead of getting a full diff.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list