Mercurial > public > mercurial-scm > hg
diff mercurial/templatekw.py @ 38948:390287321b4b
templatekw: copy {author} to {user} and document {author} as an alias
In other places including "log -Tjson" and revset, "user" is the canonical
name. Let's standardize it.
This is a part of the name unification of the Generic Templating Plan.
https://www.mercurial-scm.org/wiki/GenericTemplatingPlan#Dictionary
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 24 Jul 2018 22:13:21 +0900 |
parents | 87a581d1391c |
children | 83f8f7b9fa60 |
line wrap: on
line diff
--- a/mercurial/templatekw.py Tue Jul 24 22:33:08 2018 +0900 +++ b/mercurial/templatekw.py Tue Jul 24 22:13:21 2018 +0900 @@ -168,9 +168,8 @@ @templatekeyword('author', requires={'ctx'}) def showauthor(context, mapping): - """String. The unmodified author of the changeset.""" - ctx = context.resource(mapping, 'ctx') - return ctx.user() + """Alias for ``{user}``""" + return showuser(context, mapping) @templatekeyword('bisect', requires={'repo', 'ctx'}) def showbisect(context, mapping): @@ -757,6 +756,12 @@ ui = context.resource(mapping, 'ui') return ui.termwidth() +@templatekeyword('user', requires={'ctx'}) +def showuser(context, mapping): + """String. The unmodified author of the changeset.""" + ctx = context.resource(mapping, 'ctx') + return ctx.user() + @templatekeyword('instabilities', requires={'ctx'}) def showinstabilities(context, mapping): """List of strings. Evolution instabilities affecting the changeset.