hgweb: drop tmpl argument from webutil.showtag() and showbookmark()
authorYuya Nishihara <yuya@tcha.org>
Mon, 02 Apr 2018 00:41:19 +0900
changeset 37912 16c7a6ac8f94
parent 37911 26aed0d561e8
child 37913 89db78126f7f
hgweb: drop tmpl argument from webutil.showtag() and showbookmark() It's replaced by a context argument passed to a mappinggenerator.
mercurial/hgweb/webcommands.py
mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webcommands.py	Mon Apr 02 00:39:26 2018 +0900
+++ b/mercurial/hgweb/webcommands.py	Mon Apr 02 00:41:19 2018 +0900
@@ -295,7 +295,7 @@
         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)
 
--- a/mercurial/hgweb/webutil.py	Mon Apr 02 00:39:26 2018 +0900
+++ b/mercurial/hgweb/webutil.py	Mon Apr 02 00:41:19 2018 +0900
@@ -278,11 +278,11 @@
     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 @@
     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 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 = []