Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/webutil.py @ 37952:028d7c24f2e5
hgweb: wrap {files} of changelist entries with mappedgenerator
This also switches the associated templates conditionally, which can't be
a mappinggenerator.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 03 Apr 2018 23:32:16 +0900 |
parents | c4313a9fde7b |
children | 4237d07fad2c |
comparison
equal
deleted
inserted
replaced
37951:c4313a9fde7b | 37952:028d7c24f2e5 |
---|---|
507 diffsummary=lambda **x: diffsummary(diffstatsgen), | 507 diffsummary=lambda **x: diffsummary(diffstatsgen), |
508 diffstat=diffstats, | 508 diffstat=diffstats, |
509 archives=web.archivelist(ctx.hex()), | 509 archives=web.archivelist(ctx.hex()), |
510 **pycompat.strkwargs(commonentry(web.repo, ctx))) | 510 **pycompat.strkwargs(commonentry(web.repo, ctx))) |
511 | 511 |
512 def listfilediffs(tmpl, files, node, max): | 512 def _listfilediffsgen(context, tmpl, files, node, max): |
513 for f in files[:max]: | 513 for f in files[:max]: |
514 yield tmpl.generate('filedifflink', {'node': hex(node), 'file': f}) | 514 yield tmpl.generate('filedifflink', {'node': hex(node), 'file': f}) |
515 if len(files) > max: | 515 if len(files) > max: |
516 yield tmpl.generate('fileellipses', {}) | 516 yield tmpl.generate('fileellipses', {}) |
517 | |
518 def listfilediffs(tmpl, files, node, max): | |
519 return templateutil.mappedgenerator(_listfilediffsgen, | |
520 args=(tmpl, files, node, max)) | |
517 | 521 |
518 def diffs(web, ctx, basectx, files, style, linerange=None, | 522 def diffs(web, ctx, basectx, files, style, linerange=None, |
519 lineidprefix=''): | 523 lineidprefix=''): |
520 | 524 |
521 def prettyprintlines(lines, blockno): | 525 def prettyprintlines(lines, blockno): |