Patchwork addremove: add "ui." prefix to message color keys

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 18, 2018, 12:32 p.m.
Message ID <10e4e6d63c504f1117b0.1539865949@mimosa>
Download mbox | patch
Permalink /patch/36132/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 18, 2018, 12:32 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1539864007 -32400
#      Thu Oct 18 21:00:07 2018 +0900
# Node ID 10e4e6d63c504f1117b0d49160e301d21818515f
# Parent  17abd7febf13b99845f0305e92cfa6e321810a99
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.
Pulkit Goyal - Oct. 18, 2018, 6:14 p.m.
On Thu, Oct 18, 2018 at 3:35 PM Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1539864007 -32400
> #      Thu Oct 18 21:00:07 2018 +0900
> # Node ID 10e4e6d63c504f1117b0d49160e301d21818515f
> # Parent  17abd7febf13b99845f0305e92cfa6e321810a99
> 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.
>

Queued this one, many thanks!

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2058,7 +2058,7 @@  def add(ui, repo, match, prefix, explici
             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 @@  def forget(ui, repo, match, prefix, expl
     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 @@  def remove(ui, repo, m, prefix, after, f
         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:
diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -83,8 +83,6 @@  except ImportError:
     '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 @@  except ImportError:
     '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',
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1043,10 +1043,10 @@  def addremove(repo, matcher, prefix, opt
         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,
diff --git a/tests/test-add.t b/tests/test-add.t
--- a/tests/test-add.t
+++ b/tests/test-add.t
@@ -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
diff --git a/tests/test-addremove.t b/tests/test-addremove.t
--- a/tests/test-addremove.t
+++ b/tests/test-addremove.t
@@ -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
diff --git a/tests/test-remove.t b/tests/test-remove.t
--- a/tests/test-remove.t
+++ b/tests/test-remove.t
@@ -527,7 +527,7 @@  test dry-run for remove
   \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