Show More
@@ -519,27 +519,26 b' def listfilediffs(files, node, max):' | |||
|
519 | 519 | return templateutil.mappedgenerator(_listfilediffsgen, |
|
520 | 520 | args=(files, node, max)) |
|
521 | 521 | |
|
522 | def _prettyprintdifflines(tmpl, lines, blockno, lineidprefix): | |
|
523 | for lineno, l in enumerate(lines, 1): | |
|
524 | difflineno = "%d.%d" % (blockno, lineno) | |
|
525 | if l.startswith('+'): | |
|
526 | ltype = "difflineplus" | |
|
527 | elif l.startswith('-'): | |
|
528 | ltype = "difflineminus" | |
|
529 | elif l.startswith('@'): | |
|
530 | ltype = "difflineat" | |
|
531 | else: | |
|
532 | ltype = "diffline" | |
|
533 | yield tmpl.generate(ltype, { | |
|
534 | 'line': l, | |
|
535 | 'lineno': lineno, | |
|
536 | 'lineid': lineidprefix + "l%s" % difflineno, | |
|
537 | 'linenumber': "% 8s" % difflineno, | |
|
538 | }) | |
|
539 | ||
|
522 | 540 | def diffs(web, ctx, basectx, files, style, linerange=None, |
|
523 | 541 | lineidprefix=''): |
|
524 | ||
|
525 | def prettyprintlines(lines, blockno): | |
|
526 | for lineno, l in enumerate(lines, 1): | |
|
527 | difflineno = "%d.%d" % (blockno, lineno) | |
|
528 | if l.startswith('+'): | |
|
529 | ltype = "difflineplus" | |
|
530 | elif l.startswith('-'): | |
|
531 | ltype = "difflineminus" | |
|
532 | elif l.startswith('@'): | |
|
533 | ltype = "difflineat" | |
|
534 | else: | |
|
535 | ltype = "diffline" | |
|
536 | yield web.tmpl.generate(ltype, { | |
|
537 | 'line': l, | |
|
538 | 'lineno': lineno, | |
|
539 | 'lineid': lineidprefix + "l%s" % difflineno, | |
|
540 | 'linenumber': "% 8s" % difflineno, | |
|
541 | }) | |
|
542 | ||
|
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