changeset 22464:964dd1c491ca

color: change the debug output format Before, the format was label(labeled text) # single label [label1 label2](labeled text) # multiple Now, it's [labels|labeled text] ..which should make things a bit more clear.
author Matt Mackall <mpm@selenic.com>
date Fri, 19 Sep 2014 12:51:15 -0500
parents 1c4ae0f6a30f
children f8e2aebbb24c
files hgext/color.py tests/test-status-color.t
diffstat 2 files changed, 13 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Sun Aug 24 17:40:27 2014 -0400
+++ b/hgext/color.py	Fri Sep 19 12:51:15 2014 -0500
@@ -398,13 +398,11 @@
                 *[self.label(str(a), label) for a in args], **opts)
 
     def showlabel(self, msg, label):
-        if ' ' in label:
-            label = '[' + label + ']'
         if label:
             if msg and msg[-1] == '\n':
-                return "%s(%s)\n" % (label, msg[:-1])
+                return "[%s|%s]\n" % (label, msg[:-1])
             else:
-                return "%s(%s)" % (label, msg)
+                return "[%s|%s]" % (label, msg)
         else:
             return msg
 
--- a/tests/test-status-color.t	Sun Aug 24 17:40:27 2014 -0400
+++ b/tests/test-status-color.t	Fri Sep 19 12:51:15 2014 -0500
@@ -21,12 +21,12 @@
   \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
 
   $ hg status --color=debug
-  status.unknown(? )status.unknown(a/1/in_a_1)
-  status.unknown(? )status.unknown(a/in_a)
-  status.unknown(? )status.unknown(b/1/in_b_1)
-  status.unknown(? )status.unknown(b/2/in_b_2)
-  status.unknown(? )status.unknown(b/in_b)
-  status.unknown(? )status.unknown(in_root)
+  [status.unknown|? ][status.unknown|a/1/in_a_1]
+  [status.unknown|? ][status.unknown|a/in_a]
+  [status.unknown|? ][status.unknown|b/1/in_b_1]
+  [status.unknown|? ][status.unknown|b/2/in_b_2]
+  [status.unknown|? ][status.unknown|b/in_b]
+  [status.unknown|? ][status.unknown|in_root]
 
 hg status . in repo root:
 
@@ -146,11 +146,11 @@
   adding modified
   adding removed
   $ hg log --color=debug
-  [log.changeset changeset.draft](changeset:   0:389aef86a55e)
-  log.tag(tag:         tip)
-  log.user(user:        test)
-  log.date(date:        Thu Jan 01 00:00:00 1970 +0000)
-  log.summary(summary:     initial checkin)
+  [log.changeset changeset.draft|changeset:   0:389aef86a55e]
+  [log.tag|tag:         tip]
+  [log.user|user:        test]
+  [log.date|date:        Thu Jan 01 00:00:00 1970 +0000]
+  [log.summary|summary:     initial checkin]
   
   $ touch modified added unknown ignored
   $ hg add added