From patchwork Thu May 10 14:16:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4, of, 6] hgweb: wrap {files} of changelist entries with mappedgenerator From: Yuya Nishihara X-Patchwork-Id: 31461 Message-Id: <6d4ea75a83203052e952.1525961769@mimosa> To: mercurial-devel@mercurial-scm.org Date: Thu, 10 May 2018 23:16:09 +0900 # HG changeset patch # User Yuya Nishihara # Date 1522765936 -32400 # Tue Apr 03 23:32:16 2018 +0900 # Node ID 6d4ea75a83203052e9524ccbfadfd53fbfc4d25b # Parent ed028b800abd0c73d12b3fe6b26a3f43668c6ceb hgweb: wrap {files} of changelist entries with mappedgenerator This also switches the associated templates conditionally, which can't be a mappinggenerator. diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -509,12 +509,16 @@ def changesetentry(web, ctx): archives=web.archivelist(ctx.hex()), **pycompat.strkwargs(commonentry(web.repo, ctx))) -def listfilediffs(tmpl, files, node, max): +def _listfilediffsgen(context, tmpl, files, node, max): for f in files[:max]: yield tmpl.generate('filedifflink', {'node': hex(node), 'file': f}) if len(files) > max: yield tmpl.generate('fileellipses', {}) +def listfilediffs(tmpl, files, node, max): + return templateutil.mappedgenerator(_listfilediffsgen, + args=(tmpl, files, node, max)) + def diffs(web, ctx, basectx, files, style, linerange=None, lineidprefix=''):