changeset 39088:ad88726d6982

addremove: add labels for messages about added and removed files This is the first step to add color for add and remove output.
author Boris Feld <boris.feld@octobus.net>
date Wed, 25 Jul 2018 17:11:52 +0200
parents f90b333e79cb
children 3ff9d2ec6d88
files mercurial/scmutil.py tests/test-addremove.t
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Fri Jul 27 12:08:10 2018 +0200
+++ b/mercurial/scmutil.py	Wed Jul 25 17:11:52 2018 +0200
@@ -1005,9 +1005,11 @@
         if repo.ui.verbose or not m.exact(abs):
             if abs in unknownset:
                 status = _('adding %s\n') % m.uipath(abs)
+                label = 'addremove.added'
             else:
                 status = _('removing %s\n') % m.uipath(abs)
-            repo.ui.status(status)
+                label = 'addremove.removed'
+            repo.ui.status(status, label=label)
 
     renames = _findrenames(repo, m, added + unknown, removed + deleted,
                            similarity)
--- a/tests/test-addremove.t	Fri Jul 27 12:08:10 2018 +0200
+++ b/tests/test-addremove.t	Wed Jul 25 17:11:52 2018 +0200
@@ -69,6 +69,12 @@
   removing c
   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.status|recording removal of a as rename to b (100% similar)]
   $ hg addremove -s 50
   removing a
   adding b