changeset 30713:6d0b1a69f98c

templates: display evolution "troubles" in command line style
author Denis Laxalde <denis.laxalde@logilab.fr>
date Fri, 06 Jan 2017 13:50:52 +0100
parents 5dde81de1e6d
children 8d46eaaa589c
files mercurial/templates/map-cmdline.default tests/test-obsolete.t
diffstat 2 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/map-cmdline.default	Fri Jan 06 13:50:16 2017 +0100
+++ b/mercurial/templates/map-cmdline.default	Fri Jan 06 13:50:52 2017 +0100
@@ -1,9 +1,9 @@
 # Base templates. Due to name clashes with existing keywords, we have
 # to replace some keywords with 'lkeyword', for 'labelled keyword'
-changeset = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{summary}\n'
+changeset = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{summary}\n'
 changeset_quiet = '{lnode}'
-changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{lfiles}{lfile_copies_switch}{description}\n'
-changeset_debug = '{fullcset}{branches}{bookmarks}{tags}{lphase}{parents}{manifest}{user}{ldate}{lfile_mods}{lfile_adds}{lfile_dels}{lfile_copies_switch}{extras}{description}\n'
+changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{lfiles}{lfile_copies_switch}{description}\n'
+changeset_debug = '{fullcset}{branches}{bookmarks}{tags}{lphase}{parents}{manifest}{user}{ldate}{ltroubles}{lfile_mods}{lfile_adds}{lfile_dels}{lfile_copies_switch}{extras}{description}\n'
 
 # File templates
 lfiles = '{if(files,
@@ -28,7 +28,8 @@
                                                % ' {name} ({source})'}\n"))}'
 
 # General templates
-_cset_labels = 'log.changeset changeset.{phase}'
+_trouble_label = 'trouble.{trouble}'
+_cset_labels = 'log.changeset changeset.{phase}{if(troubles, " changeset.troubled {troubles%_trouble_label}")}'
 cset = '{label("{_cset_labels}",
                "changeset:   {rev}:{node|short}")}\n'
 
@@ -65,6 +66,9 @@
 ldate = '{label("log.date",
                 "date:        {date|date}")}\n'
 
+ltroubles = '{if(troubles, "{label('ui.note log.trouble',
+                                   'trouble:     {join(troubles, ", ")}')}\n")}'
+
 extra = '{label("ui.debug log.extra",
                 "extra:       {key}={value|stringescape}")}\n'
 
--- a/tests/test-obsolete.t	Fri Jan 06 13:50:16 2017 +0100
+++ b/tests/test-obsolete.t	Fri Jan 06 13:50:52 2017 +0100
@@ -815,6 +815,16 @@
   $ hg log -r 'bumped() and unstable()'
   7:50c51b361e60 (draft unstable bumped) [ ] add babar
 
+test the default cmdline template
+
+  $ hg log -T default -r 'bumped()'
+  changeset:   7:50c51b361e60
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  trouble:     unstable, bumped
+  summary:     add babar
+  
+
 Test incoming/outcoming with changesets obsoleted remotely, known locally
 ===============================================================================