diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -670,9 +670,7 @@ def diffsummary(statgen): return _(' %d files changed, %d insertions(+), %d deletions(-)\n') % ( len(stats), addtotal, removetotal) -def diffstat(tmpl, ctx, statgen, parity): - '''Return a diffstat template for each file in the diff.''' - +def _diffstattmplgen(context, tmpl, ctx, statgen, parity): stats, maxname, maxtotal, addtotal, removetotal, binary = next(statgen) files = ctx.files() @@ -696,6 +694,11 @@ def diffstat(tmpl, ctx, statgen, parity) 'parity': next(parity), }) +def diffstat(tmpl, ctx, statgen, parity): + '''Return a diffstat template for each file in the diff.''' + args = (tmpl, ctx, statgen, parity) + return templateutil.mappedgenerator(_diffstattmplgen, args=args) + class sessionvars(templateutil.wrapped): def __init__(self, vars, start='?'): self._start = start