Patchwork [3,of,7] hgweb: drop tmpl argument from webutil.showtag() and showbookmark()

login
register
mail settings
Submitter Yuya Nishihara
Date May 9, 2018, 1:33 p.m.
Message ID <51ef216f8ee928ccb229.1525872784@mimosa>
Download mbox | patch
Permalink /patch/31429/
State Accepted
Headers show

Comments

Yuya Nishihara - May 9, 2018, 1:33 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1522597279 -32400
#      Mon Apr 02 00:41:19 2018 +0900
# Node ID 51ef216f8ee928ccb229e92651db015fe86f5117
# Parent  7736022cdd5f377a93196e02f07f2c59c8b78151
hgweb: drop tmpl argument from webutil.showtag() and showbookmark()

It's replaced by a context argument passed to a mappinggenerator.

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -295,7 +295,7 @@  def _search(web):
         for ctx in searchfunc[0](funcarg):
             count += 1
             n = ctx.node()
-            showtags = webutil.showtag(web.repo, web.tmpl, 'changelogtag', n)
+            showtags = webutil.showtag(web.repo, 'changelogtag', n)
             files = webutil.listfilediffs(web.tmpl, ctx.files(), n,
                                           web.maxfiles)
 
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -278,11 +278,11 @@  def _nodenamesgen(context, f, node, name
     for t in f(node):
         yield {name: t}
 
-def showtag(repo, tmpl, t1, node=nullid):
+def showtag(repo, t1, node=nullid):
     args = (repo.nodetags, node, 'tag')
     return templateutil.mappinggenerator(_nodenamesgen, args=args, name=t1)
 
-def showbookmark(repo, tmpl, t1, node=nullid):
+def showbookmark(repo, t1, node=nullid):
     args = (repo.nodebookmarks, node, 'bookmark')
     return templateutil.mappinggenerator(_nodenamesgen, args=args, name=t1)
 
@@ -437,7 +437,7 @@  def changelistentry(web, ctx):
     repo = web.repo
     rev = ctx.rev()
     n = ctx.node()
-    showtags = showtag(repo, web.tmpl, 'changelogtag', n)
+    showtags = showtag(repo, 'changelogtag', n)
     files = listfilediffs(web.tmpl, ctx.files(), n, web.maxfiles)
 
     entry = commonentry(repo, ctx)
@@ -459,9 +459,8 @@  def symrevorshortnode(req, ctx):
 def changesetentry(web, ctx):
     '''Obtain a dictionary to be used to render the "changeset" template.'''
 
-    showtags = showtag(web.repo, web.tmpl, 'changesettag', ctx.node())
-    showbookmarks = showbookmark(web.repo, web.tmpl, 'changesetbookmark',
-                                 ctx.node())
+    showtags = showtag(web.repo, 'changesettag', ctx.node())
+    showbookmarks = showbookmark(web.repo, 'changesetbookmark', ctx.node())
     showbranch = nodebranchnodefault(ctx)
 
     files = []