changeset 40367:824b687ff6af

addremove: add "ui." prefix to message color keys I don't like fully-colorized status/warning messages, and I want to disable them at all. If we'd supported a syntax like 'color.ui.*=none', I could easily turn addremove.added/removed off as well as ui.error. This patch is just for that. Since addremove colors aren't released yet, which were added at ddc1da134772, there are no compatibility concerns.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 18 Oct 2018 21:00:07 +0900
parents b14fdf1fb615
children fad6068249d9
files mercurial/cmdutil.py mercurial/color.py mercurial/scmutil.py tests/test-add.t tests/test-addremove.t tests/test-remove.t
diffstat 6 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Feb 09 09:17:40 2017 -0800
+++ b/mercurial/cmdutil.py	Thu Oct 18 21:00:07 2018 +0900
@@ -2058,7 +2058,7 @@
             names.append(f)
             if ui.verbose or not exact:
                 ui.status(_('adding %s\n') % match.rel(f),
-                          label='addremove.added')
+                          label='ui.addremove.added')
 
     for subpath in sorted(wctx.substate):
         sub = wctx.sub(subpath)
@@ -2157,7 +2157,7 @@
     for f in forget:
         if ui.verbose or not match.exact(f) or interactive:
             ui.status(_('removing %s\n') % match.rel(f),
-                      label='addremove.removed')
+                      label='ui.addremove.removed')
 
     if not dryrun:
         rejected = wctx.forget(forget, prefix)
@@ -2291,7 +2291,7 @@
         if ui.verbose or not m.exact(f):
             progress.increment()
             ui.status(_('removing %s\n') % m.rel(f),
-                      label='addremove.removed')
+                      label='ui.addremove.removed')
     progress.complete()
 
     if not dryrun:
--- a/mercurial/color.py	Thu Feb 09 09:17:40 2017 -0800
+++ b/mercurial/color.py	Thu Oct 18 21:00:07 2018 +0900
@@ -83,8 +83,6 @@
     'grep.filename': 'magenta',
     'grep.user': 'magenta',
     'grep.date': 'magenta',
-    'addremove.added': 'green',
-    'addremove.removed': 'red',
     'bookmarks.active': 'green',
     'branches.active': 'none',
     'branches.closed': 'black bold',
@@ -119,6 +117,8 @@
     'formatvariant.config.default': 'green',
     'formatvariant.default': '',
     'histedit.remaining': 'red bold',
+    'ui.addremove.added': 'green',
+    'ui.addremove.removed': 'red',
     'ui.error': 'red',
     'ui.prompt': 'yellow',
     'log.changeset': 'yellow',
--- a/mercurial/scmutil.py	Thu Feb 09 09:17:40 2017 -0800
+++ b/mercurial/scmutil.py	Thu Oct 18 21:00:07 2018 +0900
@@ -1043,10 +1043,10 @@
         if repo.ui.verbose or not m.exact(abs):
             if abs in unknownset:
                 status = _('adding %s\n') % m.uipath(abs)
-                label = 'addremove.added'
+                label = 'ui.addremove.added'
             else:
                 status = _('removing %s\n') % m.uipath(abs)
-                label = 'addremove.removed'
+                label = 'ui.addremove.removed'
             repo.ui.status(status, label=label)
 
     renames = _findrenames(repo, m, added + unknown, removed + deleted,
--- a/tests/test-add.t	Thu Feb 09 09:17:40 2017 -0800
+++ b/tests/test-add.t	Thu Oct 18 21:00:07 2018 +0900
@@ -14,7 +14,7 @@
   adding a
   $ hg forget a
   $ hg add --color debug
-  [addremove.added ui.status|adding a]
+  [ui.addremove.added ui.status|adding a]
   $ hg st
   A a
   $ mkdir dir
--- a/tests/test-addremove.t	Thu Feb 09 09:17:40 2017 -0800
+++ b/tests/test-addremove.t	Thu Oct 18 21:00:07 2018 +0900
@@ -70,10 +70,10 @@
   adding d
   recording removal of a as rename to b (100% similar)
   $ hg addremove -ns 50 --color debug
-  [addremove.removed ui.status|removing a]
-  [addremove.added ui.status|adding b]
-  [addremove.removed ui.status|removing c]
-  [addremove.added ui.status|adding d]
+  [ui.addremove.removed ui.status|removing a]
+  [ui.addremove.added ui.status|adding b]
+  [ui.addremove.removed ui.status|removing c]
+  [ui.addremove.added ui.status|adding d]
   [ ui.status|recording removal of a as rename to b (100% similar)]
   $ hg addremove -s 50
   removing a
--- a/tests/test-remove.t	Thu Feb 09 09:17:40 2017 -0800
+++ b/tests/test-remove.t	Thu Oct 18 21:00:07 2018 +0900
@@ -527,7 +527,7 @@
   \r (no-eol) (esc)
   deleting [===========================================>] 1/1\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
-  [addremove.removed ui.status|removing a]
+  [ui.addremove.removed ui.status|removing a]
   $ hg diff
 
   $ cat >> .hg/hgrc <<EOF