Patchwork color: issue warning in yellow

login
register
mail settings
Submitter Boris Feld
Date Aug. 20, 2018, 8:03 a.m.
Message ID <4144148d7aba13ece916.1534752236@FB-lair>
Download mbox | patch
Permalink /patch/33894/
State Changes Requested
Headers show

Comments

Boris Feld - Aug. 20, 2018, 8:03 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1534290303 -7200
#      Wed Aug 15 01:45:03 2018 +0200
# Node ID 4144148d7aba13ece916c6f735c791ca3d93a249
# Parent  c62184c6299c09d2e8e7be340f9aee138229cb86
# EXP-Topic color-warning
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4144148d7aba
color: issue warning in yellow

Using a different color for warning/error output help them to stand out and
attract user attention. At Octobus we have been using this setting for years
with good result.

Now that `ui.error` are colored in red, it seems reasonable to color all other
error output in yellow.
David Demelier - Sept. 5, 2018, 7:11 a.m.
On Mon, 2018-08-20 at 10:03 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1534290303 -7200
> #      Wed Aug 15 01:45:03 2018 +0200
> # Node ID 4144148d7aba13ece916c6f735c791ca3d93a249
> # Parent  c62184c6299c09d2e8e7be340f9aee138229cb86
> # EXP-Topic color-warning
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/
>  -r 4144148d7aba
> color: issue warning in yellow
> 
> Using a different color for warning/error output help them to stand
> out and
> attract user attention. At Octobus we have been using this setting
> for years
> with good result.
> 
> Now that `ui.error` are colored in red, it seems reasonable to color
> all other
> error output in yellow.

I'm not very fan of this. Too much colors makes too much user
distraction. Each time I must use npm I scratch my head against all
these colors / styles used in the terminal. See [0]

Let's keep it simple, user can change this by itself, don't make
Mercurial too glassy/shiny/whatever adj you want :-)

[0]: 
https://cdn-images-1.medium.com/max/1600/1*0Io2KrHWz7XFw8GABaB9-w.png

Patch

diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -119,6 +119,7 @@  except ImportError:
     'formatvariant.config.default': 'green',
     'formatvariant.default': '',
     'histedit.remaining': 'red bold',
+    'ui.warning': 'yellow',
     'ui.error': 'red',
     'ui.prompt': 'yellow',
     'log.changeset': 'yellow',
diff --git a/tests/test-pager.t b/tests/test-pager.t
--- a/tests/test-pager.t
+++ b/tests/test-pager.t
@@ -199,7 +199,7 @@  even though stdout is no longer a tty.
 An invalid pager command name is reported sensibly if we don't have to
 use shell=True in the subprocess call:
   $ hg log --limit 3 --config pager.pager=this-command-better-never-exist
-  missing pager command 'this-command-better-never-exist', skipping pager
+  \x1b[0;33mmissing pager command 'this-command-better-never-exist', skipping pager\x1b[0m (esc)
   \x1b[0;33mchangeset:   10:46106edeeb38\x1b[0m (esc)
   tag:         tip
   user:        test
diff --git a/tests/test-status-color.t b/tests/test-status-color.t
--- a/tests/test-status-color.t
+++ b/tests/test-status-color.t
@@ -204,7 +204,7 @@  hg status:
 hg status modified added removed deleted unknown never-existed ignored:
 
   $ hg status modified added removed deleted unknown never-existed ignored
-  never-existed: * (glob)
+  \x1b[0;33mnever-existed: $ENOENT$\x1b[0m (esc)
   \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
   \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
   \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
@@ -310,9 +310,9 @@  check 'status -q' and some combinations
 test unknown color
 
   $ hg --config color.status.modified=periwinkle status
-  ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
-  ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
-  ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
+  \x1b[0;33mignoring unknown color/effect 'periwinkle' (configured in color.status.modified)\x1b[0m (esc)
+  \x1b[0;33mignoring unknown color/effect 'periwinkle' (configured in color.status.modified)\x1b[0m (esc)
+  \x1b[0;33mignoring unknown color/effect 'periwinkle' (configured in color.status.modified)\x1b[0m (esc)
   M modified
   \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
   \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
@@ -376,8 +376,8 @@  test 'resolve -l'
   $ hg merge
   merging a
   merging b
-  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  \x1b[0;33mwarning: conflicts while merging a! (edit, then use 'hg resolve --mark')\x1b[0m (esc)
+  \x1b[0;33mwarning: conflicts while merging b! (edit, then use 'hg resolve --mark')\x1b[0m (esc)
   0 files updated, 0 files merged, 0 files removed, 2 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
   [1]