##// END OF EJS Templates
hgweb: avoid generator exhaustion with branches
Matt Mackall -
r18030:ebc0fa06 stable
parent child Browse files
Show More
@@ -437,13 +437,16 b' def bookmarks(web, req, tmpl):'
437 latestentry=lambda **x: entries(1, **x))
437 latestentry=lambda **x: entries(1, **x))
438
438
439 def branches(web, req, tmpl):
439 def branches(web, req, tmpl):
440 tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems())
440 tips = []
441 heads = web.repo.heads()
441 heads = web.repo.heads()
442 parity = paritygen(web.stripecount)
442 parity = paritygen(web.stripecount)
443 sortkey = lambda ctx: (not ctx.closesbranch(), ctx.rev())
443 sortkey = lambda ctx: (not ctx.closesbranch(), ctx.rev())
444
444
445 def entries(limit, **map):
445 def entries(limit, **map):
446 count = 0
446 count = 0
447 if not tips:
448 for t, n in web.repo.branchtags().iteritems():
449 tips.append(web.repo[n])
447 for ctx in sorted(tips, key=sortkey, reverse=True):
450 for ctx in sorted(tips, key=sortkey, reverse=True):
448 if limit > 0 and count >= limit:
451 if limit > 0 and count >= limit:
449 return
452 return
General Comments 0
You need to be logged in to leave comments. Login now