[PATCH 1 of 3] web: prevent TypeError thrown when using the diffstat templates

Steven Brown stevengbrown at gmail.com
Thu Jun 2 08:12:14 CDT 2011


# HG changeset patch
# User Steven Brown <StevenGBrown at gmail.com>
# Date 1307011951 -28800
# Node ID a9941bd9c6b03f2cb17e0183ca63736cad16097f
# Parent  30506b89435921bf2e7622613044cca2acab4196
web: prevent TypeError thrown when using the diffstat templates

Remove the lambda used to wrap webutil.diffstat because:
- functions passed to the templater must accept keyword arguments
- webutil.diffstat is a generator, so already calculates the diffstat lazily

This reverts the changes made to 1d3e2349304a after it was submitted to the
mailing list but before it was queued.

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -271,7 +271,7 @@
     diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity, style)
 
     parity = paritygen(web.stripecount)
-    diffstat = lambda: webutil.diffstat(tmpl, ctx, parity)
+    diffstat = webutil.diffstat(tmpl, ctx, parity)
 
     return tmpl('changeset',
                 diff=diffs,


More information about the Mercurial-devel mailing list