changeset 4654:0d05dcb8dd37

stack: provide context to formatter with non-default --template This allows using template keywords that we don't explicitly provide to the formatter, e.g. rev, branch and topic.
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 17 May 2019 17:59:58 +0800
parents fd4f422b0b57
children bb0a5beb0ad8
files hgext3rd/topic/stack.py tests/test-topic-stack.t
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py	Sat May 11 17:14:32 2019 +0800
+++ b/hgext3rd/topic/stack.py	Fri May 17 17:59:58 2019 +0800
@@ -354,6 +354,7 @@
         states.sort()
 
         fm.startitem()
+        fm.context(ctx=ctx)
         fm.data(isentry=isentry)
 
         if idx is None:
--- a/tests/test-topic-stack.t	Sat May 11 17:14:32 2019 +0800
+++ b/tests/test-topic-stack.t	Fri May 17 17:59:58 2019 +0800
@@ -206,6 +206,13 @@
       }
   ]
 
+  $ hg stack -T '{rev}: [{branch}] [{topic}] {desc}\n'
+  5: [default] [foo] c_f
+  4: [default] [foo] c_e
+  3: [default] [foo] c_d
+  2: [default] [foo] c_c
+  1: [default] [] c_b
+
 check that topics and stack are available even if ui.strict=true
 
   $ hg topics