[PATCH 6 of 9 V3] template: compute user in obsfateusers
Yuya Nishihara
yuya at tcha.org
Tue Aug 22 11:02:08 EDT 2017
On Mon, 21 Aug 2017 10:43:58 +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 2fee3b06f7b09f35dcfa312b645cf94090c11fb9
> # Parent 66a2b0407c8cffedfae4897bd7a2f0e2d6a22363
> # EXP-Topic obsfatetemplate
> template: compute user in obsfateusers
> +def _successorsetusers(successorset, markers):
> + """ Returns a sorted list of markers users without duplicates
> + """
> + if not markers:
> + return {}
> +
> + # Check that user is present in meta
> + markersmeta = [dict(m[3]) for m in markers]
> + users = set(meta.get('user') for meta in markersmeta if meta.get('user'))
> +
> + return {'users': sorted(users)}
[...]
> + at templatefunc('obsfateusers(successors, markers)')
> +def obsfateusers(context, mapping, args):
> + """ Compute obsfate related information based on successors and markers
> + """
> + successors = evalfuncarg(context, mapping, args[0])
> + markers = evalfuncarg(context, mapping, args[1])
> + data = obsutil._successorsetusers(successors, markers)
> +
> + _hybrid = templatekw._hybrid
> +
> + def makemap(x):
> + return x
> +
> + def joinfmt(d):
> + return d
> +
> + return _hybrid(None, [data], makemap, joinfmt)
Why isn't this a list of users, but a list of dict of list of users?
More information about the Mercurial-devel
mailing list