Skip to content
Snippets Groups Projects
Commit e46b2458 authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

templatekw: minimize resource dependency of {envvars} and {termwidth}

These keywords can be evaluated without a repo.
parent 27cd8315
Branches
Tags
No related merge requests found
......@@ -443,6 +443,6 @@
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)
......@@ -447,6 +447,6 @@
"""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,5 +897,5 @@
return shownames('tags', **args)
@templatekeyword('termwidth')
def showtermwidth(repo, ctx, templ, **args):
def showtermwidth(ui, **args):
"""Integer. The width of the current terminal."""
......@@ -901,5 +901,5 @@
"""Integer. The width of the current terminal."""
return repo.ui.termwidth()
return ui.termwidth()
@templatekeyword('instabilities')
def showinstabilities(**args):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment