comparison mercurial/hgweb/webcommands.py @ 14570:9f908ef5a595

web: provide diff summary to the changeset page This is the same message displayed at the end of the "diff --stat" command. For example, "9 files changed, 1651 insertions(+), 2 deletions(-)". The webutil.diffstatgen function allows the diffstat data to be lazily calculated only once and then re-used.
author Steven Brown <StevenGBrown@gmail.com>
date Sat, 11 Jun 2011 21:11:43 +0800
parents 175e4b9d8a96
children 0cc66f13bea0
comparison
equal deleted inserted replaced
14569:017ab404e588 14570:9f908ef5a595
269 269
270 parity = paritygen(web.stripecount) 270 parity = paritygen(web.stripecount)
271 diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity, style) 271 diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity, style)
272 272
273 parity = paritygen(web.stripecount) 273 parity = paritygen(web.stripecount)
274 diffstat = webutil.diffstat(tmpl, ctx, parity) 274 diffstatgen = webutil.diffstatgen(ctx)
275 diffstat = webutil.diffstat(tmpl, ctx, diffstatgen, parity)
275 276
276 return tmpl('changeset', 277 return tmpl('changeset',
277 diff=diffs, 278 diff=diffs,
278 rev=ctx.rev(), 279 rev=ctx.rev(),
279 node=ctx.hex(), 280 node=ctx.hex(),
284 changesetbranch=showbranch, 285 changesetbranch=showbranch,
285 author=ctx.user(), 286 author=ctx.user(),
286 desc=ctx.description(), 287 desc=ctx.description(),
287 date=ctx.date(), 288 date=ctx.date(),
288 files=files, 289 files=files,
290 diffsummary=lambda **x: webutil.diffsummary(diffstatgen),
289 diffstat=diffstat, 291 diffstat=diffstat,
290 archives=web.archivelist(ctx.hex()), 292 archives=web.archivelist(ctx.hex()),
291 tags=webutil.nodetagsdict(web.repo, ctx.node()), 293 tags=webutil.nodetagsdict(web.repo, ctx.node()),
292 bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()), 294 bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()),
293 branch=webutil.nodebranchnodefault(ctx), 295 branch=webutil.nodebranchnodefault(ctx),