[PATCH 6 of 9 V4] template: compute user in obsfateusers
Yuya Nishihara
yuya at tcha.org
Thu Aug 24 11:29:40 EDT 2017
On Wed, 23 Aug 2017 17:18:40 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1499088840 -7200
> # Mon Jul 03 15:34:00 2017 +0200
> # Node ID fc257b24c35c492591f348b039d9e3f9488118a8
> # Parent 8c1da4748240142e1ee62521279cf8556192c79e
> # EXP-Topic obsfatetemplate
> template: compute user in obsfateusers
[...]
> + at templatefunc('obsfateusers(markers)')
> +def obsfateusers(context, mapping, args):
> + """ Compute obsfate related information based on markers
> +
> + (EXPERIMENTAL)
> + """
> + if not len(args) == 1:
> + # i18n: "obsfateusers" is a keyword
> + raise error.ParseError(_("obsfateusers expects two arguments"))
> +
> + markers = evalfuncarg(context, mapping, args[0])
> + if not isinstance(markers, collections.Iterable):
Nit: almost all data in template are iterable because a string is iterable.
> + # i18n: "obsfateusers" is a keyword
> + errmsg = "obsfateusers first argument should be an iterable"
> + raise error.ParseError(errmsg)
> +
> + data = obsutil._markersusers(markers)
> + return templatekw._hybrid(None, data, lambda x: x, lambda d: d)
Perhaps, templatekw.hybridlist() can be used here.
Just spotted. Not reviewed the other patches yet.
More information about the Mercurial-devel
mailing list