Patchwork [1,of,2] graphlog: bring back color to node symbol template

login
register
mail settings
Submitter Yuya Nishihara
Date March 9, 2016, 3:34 p.m.
Message ID <62d64dedd1098442819b.1457537668@mimosa>
Download mbox | patch
Permalink /patch/13723/
State Accepted
Headers show

Comments

Yuya Nishihara - March 9, 2016, 3:34 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1457535435 -32400
#      Wed Mar 09 23:57:15 2016 +0900
# Node ID 62d64dedd1098442819b8f16ae7a7848e45d3a59
# Parent  4a028fbc4ba828ead09d2e66660100ec736915f1
graphlog: bring back color to node symbol template

Follows up 3356bf61fa25. A ui object is required to render labels.
Pierre-Yves David - March 9, 2016, 6:22 p.m.
On 03/09/2016 03:34 PM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1457535435 -32400
> #      Wed Mar 09 23:57:15 2016 +0900
> # Node ID 62d64dedd1098442819b8f16ae7a7848e45d3a59
> # Parent  4a028fbc4ba828ead09d2e66660100ec736915f1
> graphlog: bring back color to node symbol template
>
> Follows up 3356bf61fa25. A ui object is required to render labels.

Sure, patch 1 in on the clowncopter.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2206,6 +2206,7 @@  def _graphnodeformatter(ui, displayer):
     def formatnode(repo, ctx):
         props['ctx'] = ctx
         props['repo'] = repo
+        props['ui'] = repo.ui
         props['revcache'] = {}
         return templater.stringify(templ('graphnode', **props))
     return formatnode
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -2407,4 +2407,11 @@  node template with changeset_templater (
   o |  5 null+5
   | |
 
+label() should just work in node template:
+
+  $ hg log -Gqr 7 --config extensions.color= --color=debug \
+  > --config ui.graphnodetemplate='{label("branch.{branch}", rev)}'
+  [branch.default|7]  [log.node|7:02dbb8e276b8]
+  |
+
   $ cd ..