[PATCH 1 of 2] ui: add ui.write() label API

Steve Borho steve at borho.org
Tue Mar 30 17:32:54 CDT 2010


On Tue, Mar 30, 2010 at 5:23 PM, Matt Mackall <mpm at selenic.com> wrote:
> On Tue, 2010-03-30 at 17:18 -0500, Steve Borho wrote:
>> On Tue, Mar 30, 2010 at 5:10 PM, Matt Mackall <mpm at selenic.com> wrote:
>> > On Fri, 2010-03-26 at 15:14 -0400, Brodie Rao wrote:
>> >> # HG changeset patch
>> >> # User Brodie Rao <me+hg at dackz.net>
>> >> # Date 1266550756 18000
>> >> # Node ID c5eaa1e8207881ad48aaeaf98fcd642bdb6c76b3
>> >> # Parent  bd36e5c0ccb110c11bf0bda72ea77171d6844f18
>> >> ui: add ui.write() label API
>> >>
>> >> This adds output labeling support with the following methods:
>> >>
>> >> - ui.write(..., label='topic.name topic2.name2 ...')
>> >> - ui.write_err(.., label=...)
>> >> - ui.popbuffer(labeled=False)
>> >> - ui.style(msg, label)
>> >
>> > Why are we adding ui.style? Isn't it just ui.write?
>>
>> I can answer this question.  The intent for ui.style() is to allow the
>> ui to decorate the provided message as per the specified label (in the
>> path, the naming is reversed as ui.label(msg, label)).  The ui is not
>> supposed to output anything based on a ui.style() call.  The caller
>> can take the decorated string and combine it with other output that is
>> later passed to ui.write().
>
> So:
>
> ui.write(msg, label=foo) == ui.write(ui.style(msg, foo))

Yes, I believe so.

--
Steve Borho


More information about the Mercurial-devel mailing list