##// END OF EJS Templates
hgweb: move prettyprintlines() closure out of diffs()...
Yuya Nishihara -
r38004:3f70466e default
parent child Browse files
Show More
@@ -519,10 +519,7 b' def listfilediffs(files, node, max):'
519 519 return templateutil.mappedgenerator(_listfilediffsgen,
520 520 args=(files, node, max))
521 521
522 def diffs(web, ctx, basectx, files, style, linerange=None,
523 lineidprefix=''):
524
525 def prettyprintlines(lines, blockno):
522 def _prettyprintdifflines(tmpl, lines, blockno, lineidprefix):
526 523 for lineno, l in enumerate(lines, 1):
527 524 difflineno = "%d.%d" % (blockno, lineno)
528 525 if l.startswith('+'):
@@ -533,13 +530,15 b' def diffs(web, ctx, basectx, files, styl'
533 530 ltype = "difflineat"
534 531 else:
535 532 ltype = "diffline"
536 yield web.tmpl.generate(ltype, {
533 yield tmpl.generate(ltype, {
537 534 'line': l,
538 535 'lineno': lineno,
539 536 'lineid': lineidprefix + "l%s" % difflineno,
540 537 'linenumber': "% 8s" % difflineno,
541 538 })
542 539
540 def diffs(web, ctx, basectx, files, style, linerange=None,
541 lineidprefix=''):
543 542 repo = web.repo
544 543 if files:
545 544 m = match.exact(repo.root, repo.getcwd(), files)
@@ -566,7 +565,8 b' def diffs(web, ctx, basectx, files, styl'
566 565 yield web.tmpl.generate('diffblock', {
567 566 'parity': next(parity),
568 567 'blockno': blockno,
569 'lines': prettyprintlines(lines, blockno),
568 'lines': _prettyprintdifflines(web.tmpl, lines, blockno,
569 lineidprefix),
570 570 })
571 571
572 572 def compare(tmpl, context, leftlines, rightlines):
General Comments 0
You need to be logged in to leave comments. Login now