Patchwork [3,of,7] templatekw: simply override {graphwidth} function by mapping variable

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 26, 2018, 2:29 p.m.
Message ID <92789aee2463ee830f9e.1519655376@mimosa>
Download mbox | patch
Permalink /patch/28409/
State Accepted
Headers show

Comments

Yuya Nishihara - Feb. 26, 2018, 2:29 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1519535554 -32400
#      Sun Feb 25 14:12:34 2018 +0900
# Node ID 92789aee2463ee830f9e85ddb377b54ebd8c48aa
# Parent  95308378b88ad89dce5bed95805ab4b72d310d40
templatekw: simply override {graphwidth} function by mapping variable

Patch

diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -889,7 +889,7 @@  def displaygraph(ui, repo, dag, displaye
         firstedge = next(edges)
         width = firstedge[2]
         displayer.show(ctx, copies=copies,
-                       _graphwidth=width, **pycompat.strkwargs(props))
+                       graphwidth=width, **pycompat.strkwargs(props))
         lines = displayer.hunk.pop(rev).split('\n')
         if not lines[-1]:
             del lines[-1]
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -552,9 +552,8 @@  def showgraphnode(repo, ctx, **args):
 @templatekeyword('graphwidth')
 def showgraphwidth(repo, ctx, templ, **args):
     """Integer. The width of the graph drawn by 'log --graph' or zero."""
-    # The value args['graphwidth'] will be this function, so we use an internal
-    # name to pass the value through props into this function.
-    return args.get('_graphwidth', 0)
+    # just hosts documentation; should be overridden by template mapping
+    return 0
 
 @templatekeyword('index')
 def showindex(**args):