##// END OF EJS Templates
hgweb: convert {diff} to a mappinggenerator with named template...
Yuya Nishihara -
r38007:8cc23a46 default
parent child Browse files
Show More
@@ -537,9 +537,8 b' def _prettyprintdifflines(context, lines'
537 537 'linenumber': "% 8s" % difflineno,
538 538 })
539 539
540 def diffs(web, ctx, basectx, files, style, linerange=None,
541 lineidprefix=''):
542 repo = web.repo
540 def _diffsgen(context, repo, ctx, basectx, files, style, stripecount,
541 linerange, lineidprefix):
543 542 if files:
544 543 m = match.exact(repo.root, repo.getcwd(), files)
545 544 else:
@@ -548,7 +547,7 b' def diffs(web, ctx, basectx, files, styl'
548 547 diffopts = patch.diffopts(repo.ui, untrusted=True)
549 548 node1 = basectx.node()
550 549 node2 = ctx.node()
551 parity = paritygen(web.stripecount)
550 parity = paritygen(stripecount)
552 551
553 552 diffhunks = patch.diffhunks(repo, node1, node2, m, opts=diffopts)
554 553 for blockno, (fctx1, fctx2, header, hunks) in enumerate(diffhunks, 1):
@@ -565,11 +564,16 b' def diffs(web, ctx, basectx, files, styl'
565 564 l = templateutil.mappedgenerator(_prettyprintdifflines,
566 565 args=(lines, blockno,
567 566 lineidprefix))
568 yield web.tmpl.generate('diffblock', {
567 yield {
569 568 'parity': next(parity),
570 569 'blockno': blockno,
571 570 'lines': l,
572 })
571 }
572
573 def diffs(web, ctx, basectx, files, style, linerange=None, lineidprefix=''):
574 args = (web.repo, ctx, basectx, files, style, web.stripecount,
575 linerange, lineidprefix)
576 return templateutil.mappinggenerator(_diffsgen, args=args, name='diffblock')
573 577
574 578 def compare(tmpl, context, leftlines, rightlines):
575 579 '''Generator function that provides side-by-side comparison data.'''
General Comments 0
You need to be logged in to leave comments. Login now