Patchwork [3,of,3,V2] color: change color of grep.rev label

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date Feb. 19, 2019, 1:03 a.m.
Message ID <4b06afa25bb124da32fc.1550538222@chloe>
Download mbox | patch
Permalink /patch/38816/
State Accepted
Headers show

Comments

Jordi Gutiérrez Hermoso - Feb. 19, 2019, 1:03 a.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1550263757 18000
#      Fri Feb 15 15:49:17 2019 -0500
# Node ID 4b06afa25bb124da32fcaa56d2b81405b4163b61
# Parent  1ef5e748ebdeec679227f78179bd36bb9b3a1667
color: change color of grep.rev label

GNU grep uses green for line numbers as we do, but I sometimes get a
bit confused when I do `hg grep --diff -n` and get both line numbers
and revisions and don't know which one is which.

A different colour can help.
Yuya Nishihara - Feb. 20, 2019, 2:49 a.m.
On Mon, 18 Feb 2019 20:03:42 -0500, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1550263757 18000
> #      Fri Feb 15 15:49:17 2019 -0500
> # Node ID 4b06afa25bb124da32fcaa56d2b81405b4163b61
> # Parent  1ef5e748ebdeec679227f78179bd36bb9b3a1667
> color: change color of grep.rev label

The series has already been queued.

> GNU grep uses green for line numbers as we do, but I sometimes get a
> bit confused when I do `hg grep --diff -n` and get both line numbers
> and revisions and don't know which one is which.

I've marked this as "(BC)" since this is IMHO a significant change. Blue on
black is unreadable on my machine.
Jordi Gutiérrez Hermoso - Feb. 20, 2019, 4:11 a.m.
On Wed, 2019-02-20 at 11:49 +0900, Yuya Nishihara wrote:

> I've marked this as "(BC)" since this is IMHO a significant change.
> Blue on black is unreadable on my machine.

It's kind of hard to predict what will be readable. Linux terminal
emulators usually let you define "blue" to be whatever you want.

I wasn't sure if colour changes were BC, but I did put them in
separate commits so they could easily be separately dropped. I'm okay
with not changing the default colours and just adding more stuff to my
config. The only part I really wanted was extra labels.
Yuya Nishihara - Feb. 20, 2019, 4:58 a.m.
On Tue, 19 Feb 2019 23:11:13 -0500, Jordi Gutiérrez Hermoso wrote:
> On Wed, 2019-02-20 at 11:49 +0900, Yuya Nishihara wrote:
> 
> > I've marked this as "(BC)" since this is IMHO a significant change.
> > Blue on black is unreadable on my machine.
> 
> It's kind of hard to predict what will be readable. Linux terminal
> emulators usually let you define "blue" to be whatever you want.

Yes.

> I wasn't sure if colour changes were BC, but I did put them in
> separate commits so they could easily be separately dropped. I'm okay
> with not changing the default colours and just adding more stuff to my
> config. The only part I really wanted was extra labels.

I'm not against this change. My point is that changing colors generally makes
someone unhappy, which is IMHO a behavior change.

Patch

diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -77,7 +77,7 @@  except ImportError:
 _defaultstyles = {
     'grep.match': 'red bold',
     'grep.linenumber': 'green',
-    'grep.rev': 'green',
+    'grep.rev': 'blue',
     'grep.sep': 'cyan',
     'grep.filename': 'magenta',
     'grep.user': 'magenta',
diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -50,9 +50,9 @@  simple with color
 
   $ hg --config extensions.color= grep --config color.mode=ansi \
   >     --color=always port port -r tip:0
-  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
-  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
-  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc)
+  \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc)
 
 simple templated
 
@@ -305,9 +305,9 @@  Test wdir
   [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.inserted grep.change|+][grep.sep|:][grep.match|orange]
 
   $ hg grep --diff orange --color=yes
-  \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m3\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
-  \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m2\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1m-\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
-  \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m1\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
+  \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m3\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
+  \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m2\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1m-\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
+  \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;34m1\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
 
   $ hg grep --diff orange
   color:3:+:orange