# HG changeset patch # User Yuya Nishihara # Date 2018-04-03 14:32:16 # Node ID 028d7c24f2e527cafb7820ca9900b6c957632480 # Parent c4313a9fde7bb13db6d1881da55a6f2c527e61e4 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=''):