517 |
517 |
518 def listfilediffs(files, node, max): |
518 def listfilediffs(files, node, max): |
519 return templateutil.mappedgenerator(_listfilediffsgen, |
519 return templateutil.mappedgenerator(_listfilediffsgen, |
520 args=(files, node, max)) |
520 args=(files, node, max)) |
521 |
521 |
522 def _prettyprintdifflines(tmpl, lines, blockno, lineidprefix): |
522 def _prettyprintdifflines(context, tmpl, lines, blockno, lineidprefix): |
523 for lineno, l in enumerate(lines, 1): |
523 for lineno, l in enumerate(lines, 1): |
524 difflineno = "%d.%d" % (blockno, lineno) |
524 difflineno = "%d.%d" % (blockno, lineno) |
525 if l.startswith('+'): |
525 if l.startswith('+'): |
526 ltype = "difflineplus" |
526 ltype = "difflineplus" |
527 elif l.startswith('-'): |
527 elif l.startswith('-'): |
560 s1, l1, s2, l2 = hunkrange |
560 s1, l1, s2, l2 = hunkrange |
561 if not mdiff.hunkinrange((s2, l2), linerange): |
561 if not mdiff.hunkinrange((s2, l2), linerange): |
562 continue |
562 continue |
563 lines.extend(hunklines) |
563 lines.extend(hunklines) |
564 if lines: |
564 if lines: |
|
565 l = templateutil.mappedgenerator(_prettyprintdifflines, |
|
566 args=(web.tmpl, lines, blockno, |
|
567 lineidprefix)) |
565 yield web.tmpl.generate('diffblock', { |
568 yield web.tmpl.generate('diffblock', { |
566 'parity': next(parity), |
569 'parity': next(parity), |
567 'blockno': blockno, |
570 'blockno': blockno, |
568 'lines': _prettyprintdifflines(web.tmpl, lines, blockno, |
571 'lines': l, |
569 lineidprefix), |
|
570 }) |
572 }) |
571 |
573 |
572 def compare(tmpl, context, leftlines, rightlines): |
574 def compare(tmpl, context, leftlines, rightlines): |
573 '''Generator function that provides side-by-side comparison data.''' |
575 '''Generator function that provides side-by-side comparison data.''' |
574 |
576 |