debugtemplate: pass ui to templater so label() works
authorYuya Nishihara <yuya@tcha.org>
Sat, 18 Mar 2017 19:59:47 +0900
changeset 31517 468bc8a1863d
parent 31515 527a247f114f
child 31518 43d6ef658874
debugtemplate: pass ui to templater so label() works Follows up 3356bf61fa25.
mercurial/debugcommands.py
--- a/mercurial/debugcommands.py	Sun Mar 19 11:42:17 2017 -0700
+++ b/mercurial/debugcommands.py	Sat Mar 18 19:59:47 2017 +0900
@@ -2019,7 +2019,7 @@
     for d in opts['define']:
         try:
             k, v = (e.strip() for e in d.split('=', 1))
-            if not k:
+            if not k or k == 'ui':
                 raise ValueError
             props[k] = v
         except ValueError:
@@ -2037,7 +2037,7 @@
     if revs is None:
         k = 'debugtemplate'
         t = formatter.maketemplater(ui, k, tmpl)
-        ui.write(templater.stringify(t(k, **props)))
+        ui.write(templater.stringify(t(k, ui=ui, **props)))
     else:
         displayer = cmdutil.changeset_templater(ui, repo, None, opts, tmpl,
                                                 mapfile, buffered=False)