From patchwork Wed May 9 13:33:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 7] hgweb: drop tmpl argument from webutil.showtag() and showbookmark() From: Yuya Nishihara X-Patchwork-Id: 31429 Message-Id: <51ef216f8ee928ccb229.1525872784@mimosa> To: mercurial-devel@mercurial-scm.org Date: Wed, 09 May 2018 22:33:04 +0900 # HG changeset patch # User Yuya Nishihara # 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. 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 = []