cmdutil: allow extra properties to be added to each context
The changeset displayer allows setting extra keywords to be available
to the templating layer. This patch adds an argument to displaygraph()
to pass a dict of extra properties to be available to every changeset.
Differential Revision: https://phab.mercurial-scm.org/D555
--- a/mercurial/cmdutil.py Thu Sep 14 09:41:22 2017 -0700
+++ b/mercurial/cmdutil.py Thu Aug 03 21:13:27 2017 -0700
@@ -2617,7 +2617,8 @@
return formatnode
def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
- filematcher=None):
+ filematcher=None, props=None):
+ props = props or {}
formatnode = _graphnodeformatter(ui, displayer)
state = graphmod.asciistate()
styles = state['styles']
@@ -2658,7 +2659,7 @@
firstedge = next(edges)
width = firstedge[2]
displayer.show(ctx, copies=copies, matchfn=revmatchfn,
- _graphwidth=width)
+ _graphwidth=width, **props)
lines = displayer.hunk.pop(rev).split('\n')
if not lines[-1]:
del lines[-1]