[PATCH] color: add default colors for draft and secret changes
Matt Mackall
mpm at selenic.com
Tue May 26 20:07:55 UTC 2015
# HG changeset patch
# User Matt Mackall <mpm at selenic.com>
# Date 1432333213 18000
# Fri May 22 17:20:13 2015 -0500
# Node ID 8e4a41b04eb9373da8c3639edfb060187465809c
# Parent da0105aee52a058e03db3e9c9a187962efc0c7db
color: add default colors for draft and secret changes
This highlights the changeset number in logs and summary. Together
with log -G, it gives a visual indication of which portions of your
repo are in which phase.
I've chosen draft = magenta and secret = red. Public changesets
currently automatically use yellow today. There are basically no
"good" color choices available in this palette (I have to squint at
most of them), so I'm not going to belabor the selection process.
diff -r da0105aee52a -r 8e4a41b04eb9 hgext/color.py
--- a/hgext/color.py Fri May 22 17:08:59 2015 -0500
+++ b/hgext/color.py Fri May 22 17:20:13 2015 -0500
@@ -78,8 +78,8 @@
# Blank so it inherits the style of the surrounding label
changeset.public =
- changeset.draft =
- changeset.secret =
+ changeset.draft = magenta
+ changeset.secret = red
resolve.unresolved = red bold
resolve.resolved = green bold
@@ -329,8 +329,8 @@
'diff.tab': '',
'diff.trailingwhitespace': 'bold red_background',
'changeset.public' : '',
- 'changeset.draft' : '',
- 'changeset.secret' : '',
+ 'changeset.draft' : 'magenta',
+ 'changeset.secret' : 'red',
'diffstat.deleted': 'red',
'diffstat.inserted': 'green',
'histedit.remaining': 'red bold',
diff -r da0105aee52a -r 8e4a41b04eb9 tests/test-branches.t
--- a/tests/test-branches.t Fri May 22 17:08:59 2015 -0500
+++ b/tests/test-branches.t Fri May 22 17:20:13 2015 -0500
@@ -428,19 +428,19 @@
$ hg up -C b
2 files updated, 0 files merged, 3 files removed, 0 files unresolved
$ hg branches --color=always
- \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
- \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
- \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
- \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
+ \x1b[0;32mb\x1b[0m\x1b[0;33;35m 13:e23b5505d1ad\x1b[0m (esc)
+ \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33;35m 7:10ff5895aa57\x1b[0m (esc)
+ \x1b[0;0ma\x1b[0m\x1b[0;33;35m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
+ \x1b[0;0mdefault\x1b[0m\x1b[0;33;35m 0:19709c5a4e75\x1b[0m (inactive) (esc)
default closed branch color:
$ hg branches --color=always --closed
- \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
- \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
- \x1b[0;30;1mc\x1b[0m\x1b[0;33m 14:f894c25619d3\x1b[0m (closed) (esc)
- \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
- \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
+ \x1b[0;32mb\x1b[0m\x1b[0;33;35m 13:e23b5505d1ad\x1b[0m (esc)
+ \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33;35m 7:10ff5895aa57\x1b[0m (esc)
+ \x1b[0;30;1mc\x1b[0m\x1b[0;33;35m 14:f894c25619d3\x1b[0m (closed) (esc)
+ \x1b[0;0ma\x1b[0m\x1b[0;33;35m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
+ \x1b[0;0mdefault\x1b[0m\x1b[0;33;35m 0:19709c5a4e75\x1b[0m (inactive) (esc)
$ cat <<EOF >> $HGRCPATH
> [extensions]
@@ -456,19 +456,19 @@
custom branch colors:
$ hg branches --color=always
- \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
- \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
- \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
- \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
+ \x1b[0;31mb\x1b[0m\x1b[0;36;35m 13:e23b5505d1ad\x1b[0m (esc)
+ \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36;35m 7:10ff5895aa57\x1b[0m (esc)
+ \x1b[0;35ma\x1b[0m\x1b[0;36;35m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
+ \x1b[0;35mdefault\x1b[0m\x1b[0;36;35m 0:19709c5a4e75\x1b[0m (inactive) (esc)
custom closed branch color:
$ hg branches --color=always --closed
- \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
- \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
- \x1b[0;34mc\x1b[0m\x1b[0;36m 14:f894c25619d3\x1b[0m (closed) (esc)
- \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
- \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
+ \x1b[0;31mb\x1b[0m\x1b[0;36;35m 13:e23b5505d1ad\x1b[0m (esc)
+ \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36;35m 7:10ff5895aa57\x1b[0m (esc)
+ \x1b[0;34mc\x1b[0m\x1b[0;36;35m 14:f894c25619d3\x1b[0m (closed) (esc)
+ \x1b[0;35ma\x1b[0m\x1b[0;36;35m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
+ \x1b[0;35mdefault\x1b[0m\x1b[0;36;35m 0:19709c5a4e75\x1b[0m (inactive) (esc)
template output:
diff -r da0105aee52a -r 8e4a41b04eb9 tests/test-log.t
--- a/tests/test-log.t Fri May 22 17:08:59 2015 -0500
+++ b/tests/test-log.t Fri May 22 17:20:13 2015 -0500
@@ -833,7 +833,7 @@
$ hg --config extensions.color= --config color.mode=ansi \
> log -p -l2 --color=always
- \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc)
+ \x1b[0;33;35mchangeset: 6:2404bbcab562\x1b[0m (esc)
tag: tip
user: test
date: Thu Jan 01 00:00:01 1970 +0000
@@ -846,9 +846,9 @@
b1
\x1b[0;32m+postm\x1b[0m (esc)
- \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc)
- parent: 3:e62f78d544b4
- parent: 4:ddb82e70d1a1
+ \x1b[0;33;35mchangeset: 5:302e9dd6890d\x1b[0m (esc)
+ \x1b[0;35mparent: 3:e62f78d544b4\x1b[0m (esc)
+ \x1b[0;35mparent: 4:ddb82e70d1a1\x1b[0m (esc)
user: test
date: Thu Jan 01 00:00:01 1970 +0000
summary: m12
@@ -1717,7 +1717,7 @@
$ hg --config extensions.names=../names.py \
> --config extensions.color= --config color.log.barcolor=red \
> --color=always log -r 0
- \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc)
+ \x1b[0;33;35mchangeset: 0:65624cd9070a\x1b[0m (esc)
tag: tip
\x1b[0;31mbarlog: foo\x1b[0m (esc)
user: test
More information about the Mercurial-devel
mailing list