[PATCH 3 of 5 V5] template: compute dates in obsfatedate

Yuya Nishihara yuya at tcha.org
Tue Aug 29 09:15:22 EDT 2017


On Mon, 28 Aug 2017 21:59:51 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1499088850 -7200
> #      Mon Jul 03 15:34:10 2017 +0200
> # Node ID 678a8ca41a5a83ea9a32e12a7aa2855271468c70
> # Parent  97f45f277a5877a1b1b0867cda800029c5a61493
> # EXP-Topic obsfatetemplate
> template: compute dates in obsfatedate

> + at templatefunc('obsfatedate(markers)')
> +def obsfatedate(context, mapping, args):
> +    """ Compute obsfate related information based on markers
> +
> +    (EXPERIMENTAL)
> +    """
> +    if len(args) != 1:
> +        # i18n: "obsfatedate" is a keyword
> +        raise error.ParseError(_("obsfatedate expects one arguments"))
> +
> +    markers = evalfuncarg(context, mapping, args[0])
> +
> +    try:
> +        data = obsutil.markersdates(markers)
> +        return templatekw._hybrid(None, data, lambda x: x, lambda d: d)

makemap should return {'date': x}, and joinfmt should stringify it. Replaced
with hybridlist(data, name='date', fmt='%d %d').


More information about the Mercurial-devel mailing list