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

Brodie Rao dackze at gmail.com
Tue Mar 30 17:53:26 CDT 2010


On Mar 30, 2010, at 6:10 PM, Matt Mackall 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?

Sorry, that should be ui.label() in the commit description. It's a convenience function so you can label individual parts of a string without numerous ui.write() calls. You can see examples of its usage in hgext.churn and hgext.mq.

You're right about the ui.write(ui.label(foo, bar)) == ui.write(foo, label=bar) equivalence.

> This patch needs splitting. I got bored scrolling through it for the
> part I was interested in. Can we get:
> 
> - a patch with just the ui.py changes
> - one patch for each command
> 
> We're also going to need some pointers somewhere on how to name styles.

Sure.


More information about the Mercurial-devel mailing list