Patchwork [2,of,3,V2] color: give colours to the grep.inserted and grep.deleted labels

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date Feb. 19, 2019, 1:03 a.m.
Message ID <1ef5e748ebdeec679227.1550538221@chloe>
Download mbox | patch
Permalink /patch/38814/
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 1550263402 18000
#      Fri Feb 15 15:43:22 2019 -0500
# Node ID 1ef5e748ebdeec679227f78179bd36bb9b3a1667
# Parent  14bb51f7e85c68b31a96ea6447f7439ac2d87e18
color: give colours to the grep.inserted and grep.deleted labels

I find the "bold" makes it stand out a bit more when the green is next
to the line number.

Note that these labels are applied before the grep.change label, which
is now disabled. To get the old colour, users can restore

    [color]
    grep.change = green dim

to their hgrc.

Patch

diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -78,11 +78,12 @@  except ImportError:
     'grep.match': 'red bold',
     'grep.linenumber': 'green',
     'grep.rev': 'green',
-    'grep.change': 'green',
     'grep.sep': 'cyan',
     'grep.filename': 'magenta',
     'grep.user': 'magenta',
     'grep.date': 'magenta',
+    'grep.inserted': 'green bold',
+    'grep.deleted': 'red bold',
     'bookmarks.active': 'green',
     'branches.active': 'none',
     'branches.closed': 'black bold',
diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -304,6 +304,11 @@  Test wdir
   [grep.filename|color][grep.sep|:][grep.rev|2][grep.sep|:][grep.deleted grep.change|-][grep.sep|:][grep.match|orange]
   [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)
+
   $ hg grep --diff orange
   color:3:+:orange
   color:2:-:orange