[PATCH] Enable color support for the branches command

Brodie Rao brodie at bitheap.org
Thu Jul 29 10:01:23 CDT 2010


On Jul 29, 2010, at 4:52 AM, Nicolas Dumazet wrote:

> Hello!
> 
> On Thu, 29 Jul 2010 00:38:13 -0600
> Jeremy Whitlock <jcscoobyrs at gmail.com> wrote:
> 
>> # HG changeset patch
>> # User Jeremy Whitlock <jcscoobyrs at gmail.com>
>> # Date 1280379903 21600
>> # Node ID ff03b97e4525883cb4d6da3e4052b6834f39eba1
>> # Parent  efcdf6a953a09efbf06129556a1d07c3ee04e0e0
> 
> Interestingly, Gmail shows a cset that is completely borked,
> apparently having troubles with line endings, while Sylpheed is just happy
> with the patch

It's probably the control codes in the test output.

>> +echo "[extensions]" >> $HGRCPATH
>> +echo "color =" >> $HGRCPATH
>> +echo "[color]" >> $HGRCPATH
>> +echo "branches.active = green" >> $HGRCPATH
>> +echo "branches.closed = blue" >> $HGRCPATH
>> +echo "branches.current = red" >> $HGRCPATH
>> +echo "branches.inactive = magenta" >> $HGRCPATH
> 
> I wonder how the user is supposed to know that he can override the
> label "branches.inactive" for example, as it's not documented?
> 
> Is it something that is missing in this patch? is it a shortcoming in
> our current code?
> Any suggestions on how to improve this system?

The labels without default colors can be added with a value of "none" to the hgext.color._styles dict and color's doc string.

Looking through the code, I've found more labels that didn't get documented:

qseries.guarded
qseries.message.{applied,unapplied,guarded,missing}
qguard.{positive,negative,unguarded}
log.{node,changeset,branch,tag,parent,manifest,user,date,files,copies,extra,description,summary}
ui.{status,warning,note,debug}

Maybe the portion of the doc string that lists label defaults can be auto-generated based on _styles? If this is done after all extensions are loaded, colortables for those will show up in the doc string as well.

On the other hand, the list would get pretty big quickly.


More information about the Mercurial-devel mailing list