[PATCH] template: add predecessors template

Yuya Nishihara yuya at tcha.org
Fri Jun 16 08:52:31 EDT 2017


On Thu, 15 Jun 2017 15:41:08 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1497524578 -7200
> #      Thu Jun 15 13:02:58 2017 +0200
> # Node ID 00744d4a892ea0f804e03f08aeff9f13c3a6f71f
> # Parent  3abba5bc34546951b11b1bd3f5e5c77b90d950d1
> # EXP-Topic predecessorstemplate
> template: add predecessors template

> + at templatekeyword("predecessors")
> +def shownextvisiblepredecessors(repo, ctx, **args):

Nit: s/shownextvisiblepredecessors/showpredecessors/

> +    """Returns the list if the closest visible successors
> +    """
> +    predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node()))
> +
> +    return _hybrid(None, predecessors, lambda x: {'predecessor': x},
> +                   lambda d: "%s" % short(d['predecessor']))

A node id in templater should be hex string. Can you change predecessors
to a list of hex node ids so e.g. {predecessors|json} can be readable?


More information about the Mercurial-devel mailing list