[PATCH 0 of 2] ui: provide ui.write() labeling for simpler output styling/colorizing

Steve Borho steve at borho.org
Tue Mar 30 12:07:08 CDT 2010


On Fri, Mar 26, 2010 at 2:14 PM, Brodie Rao <dackze at gmail.com> wrote:
> This patch series provides a new API that allows output annotation with
> ui.write() and a new ui.label() method. This allows extensions like color
> to wrap ui's write-related methods, extract these annotations, and apply
> colors - instead of trying to parse the output of each command it colorizes.
>
> The implementations in the core ui class don't actually do anything, so
> the added overhead should be minimal.
>
> Besides the color extension, this could also be used for win32 colorization,
> or GUI-specific styling. color is the only implementation I've taken a look
> at it, so I'd appreciate any feedback on how amenable the API is to other
> output formats/contexts.
>
> I'm also not sure I like how diff labeling currently works. I've added a
> couple new functions to the patch module that yield 2-tuples with diff(stat)
> text and labels that the caller can then pass to ui.write(). I have a
> feeling there might be a nicer way to do this than what I have currently.

These get a +1 from me.  Anyone have a problem with these changes?

--
Steve Borho


More information about the Mercurial-devel mailing list