# HG changeset patch # User Matt Mackall # Date 1354821687 21600 # Node ID ebc0fa067c07808b77f060e285d0c9d8d25c6750 # Parent 109a6a9dcca8db1aa69e6a7b42a36e34166fa133 hgweb: avoid generator exhaustion with branches diff -r 109a6a9dcca8 -r ebc0fa067c07 mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Wed Dec 05 15:38:18 2012 -0600 +++ b/mercurial/hgweb/webcommands.py Thu Dec 06 13:21:27 2012 -0600 @@ -437,13 +437,16 @@ latestentry=lambda **x: entries(1, **x)) def branches(web, req, tmpl): - tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems()) + tips = [] heads = web.repo.heads() parity = paritygen(web.stripecount) sortkey = lambda ctx: (not ctx.closesbranch(), ctx.rev()) def entries(limit, **map): count = 0 + if not tips: + for t, n in web.repo.branchtags().iteritems(): + tips.append(web.repo[n]) for ctx in sorted(tips, key=sortkey, reverse=True): if limit > 0 and count >= limit: return