[PATCH 1 of 5] debugtemplate: pass ui to templater so label() works

Yuya Nishihara yuya at tcha.org
Sat Mar 18 10:12:11 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1489834787 -32400
#      Sat Mar 18 19:59:47 2017 +0900
# Node ID c2c07fbe795a863799630dd08a9418041b981c8b
# Parent  da7d19324b1e3d2ce0636bf73e76bf8f3d68ed27
debugtemplate: pass ui to templater so label() works

Follows up 3356bf61fa25.

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2019,7 +2019,7 @@ def debugtemplate(ui, repo, tmpl, **opts
     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 @@ def debugtemplate(ui, repo, tmpl, **opts
     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)


More information about the Mercurial-devel mailing list