Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/webutil.py @ 38585:66eb74f9d87d
hgweb: pass ui to diffstatgen() explicitly
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 06 Jul 2018 21:35:47 +0900 |
parents | 1770416de208 |
children | 1c93e0237a24 |
comparison
equal
deleted
inserted
replaced
38584:c6398fc2fc9c | 38585:66eb74f9d87d |
---|---|
507 style = web.req.qsparams['style'] | 507 style = web.req.qsparams['style'] |
508 | 508 |
509 diff = diffs(web, ctx, basectx, None, style) | 509 diff = diffs(web, ctx, basectx, None, style) |
510 | 510 |
511 parity = paritygen(web.stripecount) | 511 parity = paritygen(web.stripecount) |
512 diffstatsgen = diffstatgen(ctx, basectx) | 512 diffstatsgen = diffstatgen(web.repo.ui, ctx, basectx) |
513 diffstats = diffstat(ctx, diffstatsgen, parity) | 513 diffstats = diffstat(ctx, diffstatsgen, parity) |
514 | 514 |
515 return dict( | 515 return dict( |
516 diff=diff, | 516 diff=diff, |
517 symrev=symrevorshortnode(web.req, ctx), | 517 symrev=symrevorshortnode(web.req, ctx), |
653 def compare(contextnum, leftlines, rightlines): | 653 def compare(contextnum, leftlines, rightlines): |
654 args = (contextnum, leftlines, rightlines) | 654 args = (contextnum, leftlines, rightlines) |
655 return templateutil.mappinggenerator(_comparegen, args=args, | 655 return templateutil.mappinggenerator(_comparegen, args=args, |
656 name='comparisonblock') | 656 name='comparisonblock') |
657 | 657 |
658 def diffstatgen(ctx, basectx): | 658 def diffstatgen(ui, ctx, basectx): |
659 '''Generator function that provides the diffstat data.''' | 659 '''Generator function that provides the diffstat data.''' |
660 | 660 |
661 diffopts = patch.diffopts(ctx._repo.ui, {'noprefix': False}) | 661 diffopts = patch.diffopts(ui, {'noprefix': False}) |
662 stats = patch.diffstatdata( | 662 stats = patch.diffstatdata( |
663 util.iterlines(ctx.diff(basectx, opts=diffopts))) | 663 util.iterlines(ctx.diff(basectx, opts=diffopts))) |
664 maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats) | 664 maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats) |
665 while True: | 665 while True: |
666 yield stats, maxname, maxtotal, addtotal, removetotal, binary | 666 yield stats, maxname, maxtotal, addtotal, removetotal, binary |