changeset 36442:e46b24582fa0

templatekw: minimize resource dependency of {envvars} and {termwidth} These keywords can be evaluated without a repo.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 25 Feb 2018 14:14:33 +0900
parents 27cd83152d31
children 8dbd97aef915
files mercurial/templatekw.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatekw.py	Sun Feb 25 14:12:34 2018 +0900
+++ b/mercurial/templatekw.py	Sun Feb 25 14:14:33 2018 +0900
@@ -443,10 +443,10 @@
     return '%s: +%s/-%s' % (len(stats), adds, removes)
 
 @templatekeyword('envvars')
-def showenvvars(repo, **args):
+def showenvvars(ui, **args):
     """A dictionary of environment variables. (EXPERIMENTAL)"""
     args = pycompat.byteskwargs(args)
-    env = repo.ui.exportableenviron()
+    env = ui.exportableenviron()
     env = util.sortdict((k, env[k]) for k in sorted(env))
     return showdict('envvar', env, args, plural='envvars')
 
@@ -897,9 +897,9 @@
     return shownames('tags', **args)
 
 @templatekeyword('termwidth')
-def showtermwidth(repo, ctx, templ, **args):
+def showtermwidth(ui, **args):
     """Integer. The width of the current terminal."""
-    return repo.ui.termwidth()
+    return ui.termwidth()
 
 @templatekeyword('instabilities')
 def showinstabilities(**args):