Mercurial > hg-stable
changeset 30299:bb2dfc0ea5b4
color: sort output of 'debugcolor'
The previous ordering were provided by the set. The new output is more stable
and rational. In addition we have some logic to keep the '_background' version
together to help readability.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 03 Nov 2016 15:15:47 +0100 |
parents | 7556507f7197 |
children | d44c407a5999 |
files | hgext/color.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/color.py Thu Nov 03 14:48:47 2016 +0100 +++ b/hgext/color.py Thu Nov 03 15:15:47 2016 +0100 @@ -556,7 +556,10 @@ elif k.startswith('terminfo.'): _styles[k] = k[9:] ui.write(_('available colors:\n')) - for colorname, label in _styles.items(): + # sort label with a '_' after the other to group '_background' entry. + items = sorted(_styles.items(), + key=lambda i: ('_' in i[0], i[0], i[1])) + for colorname, label in items: ui.write(('%s\n') % colorname, label=label) finally: _styles = oldstyle