[PATCH] color: issue warning in yellow

Boris Feld boris.feld at octobus.net
Mon Aug 20 08:03:56 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at 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.

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]


More information about the Mercurial-devel mailing list