Patchwork [v2] compact: add color labels to -Tcompact

login
register
mail settings
Submitter timeless@mozdev.org
Date April 8, 2016, 6:44 p.m.
Message ID <f57281a8abb710ba9b84.1460141079@waste.org>
Download mbox | patch
Permalink /patch/14446/
State Accepted
Headers show

Comments

timeless@mozdev.org - April 8, 2016, 6:44 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1460131552 0
#      Fri Apr 08 16:05:52 2016 +0000
# Node ID f57281a8abb710ba9b84bc9f7cb2f0da2432dd6b
# Parent  c5565fc8848dd084d104ca40c33d1acdfcff8bc6
compact: add color labels to -Tcompact

Patch

diff --git a/mercurial/templates/map-cmdline.compact b/mercurial/templates/map-cmdline.compact
--- a/mercurial/templates/map-cmdline.compact
+++ b/mercurial/templates/map-cmdline.compact
@@ -1,12 +1,30 @@ 
-changeset = '{rev}{tags}{bookmarks}{parents}   {node|short}   {date|isodate}   {author|user}\n  {desc|firstline|strip}\n\n'
-changeset_quiet = '{rev}:{node|short}\n'
-changeset_verbose = '{rev}{tags}{parents}   {node|short}   {date|isodate}   {author}\n  {desc|strip}\n\n'
+ldate = '{label("log.date",
+                "{date|isodate}")}'
+
+ldesc = '{label('ui.note log.description',
+                      '{desc|strip}')}'
+ldescfirst = '{label('ui.note log.description',
+                     '{desc|firstline|strip}')}'
+
+changeset = '{lrev}{tags}{bookmarks}{parents}   {lnode}   {ldate}   {luser}\n  {ldescfirst}\n\n'
+changeset_quiet = '{lrev}:{lnode}\n'
+changeset_verbose = '{lrev}{tags}{parents}   {lnode}   {ldate}   {lauthor}\n  {ldesc}\n\n'
+lrev = '{label("log.changeset changeset.{phase}",
+              "{rev}")}'
+lnode = '{label("log.node",
+                "{node|short}")}'
+lauthor = '{label("log.user",
+                  "{author}")}'
+luser = '{label("log.user",
+                "{author|user}")}'
 start_tags = '['
-tag = '{tag},'
+tag = '{label("log.tag",
+              "{tag},")}'
 last_tag = '{tag}]'
 start_parents = ':'
-parent = '{rev},'
-last_parent = '{rev}'
+parent = '{lrev},'
+last_parent = '{lrev}'
 start_bookmarks = '['
-bookmark = '{bookmark},'
+bookmark = '{label("log.bookmark",
+                   "{bookmark},")}'
 last_bookmark = '{bookmark}]'
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
@@ -163,6 +163,10 @@ 
   [log.date|date:        Thu Jan 01 00:00:00 1970 +0000]
   [log.summary|summary:     initial checkin]
   
+  $ hg log -Tcompact --color=debug
+  [log.changeset changeset.draft|0][tip]   [log.node|389aef86a55e]   [log.date|1970-01-01 00:00 +0000]   [log.user|test]
+    [ui.note log.description|initial checkin]
+  
 Labels on empty strings should not be displayed, labels on custom
 templates should be.