diff mercurial/cmdutil.py @ 34201:e9898ad31115

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 03 Aug 2017 21:13:27 -0700
parents ae95853c250a
children 61714510220d
line wrap: on
line diff
--- 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]