[PATCH] compact: add color labels to -Tcompact
timeless
timeless at mozdev.org
Fri Apr 8 16:07:09 UTC 2016
# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1460131552 0
# Fri Apr 08 16:05:52 2016 +0000
# Node ID f57281a8abb710ba9b84bc9f7cb2f0da2432dd6b
# Parent c5565fc8848dd084d104ca40c33d1acdfcff8bc6
compact: add color labels to -Tcompact
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.
More information about the Mercurial-devel
mailing list