##// END OF EJS Templates
hgweb: move getblock() closure out of compare()...
Yuya Nishihara -
r38009:53b0a51a default
parent child Browse files
Show More
@@ -591,10 +591,7 b' def _compline(tmpl, type, leftlineno, le'
591 591 'rightline': rightline or '',
592 592 })
593 593
594 def compare(tmpl, context, leftlines, rightlines):
595 '''Generator function that provides side-by-side comparison data.'''
596
597 def getblock(opcodes):
594 def _getcompblock(tmpl, leftlines, rightlines, opcodes):
598 595 for type, llo, lhi, rlo, rhi in opcodes:
599 596 len1 = lhi - llo
600 597 len2 = rhi - rlo
@@ -623,13 +620,16 b' def compare(tmpl, context, leftlines, ri'
623 620 rightlineno=i + 1,
624 621 rightline=rightlines[i])
625 622
623 def compare(tmpl, context, leftlines, rightlines):
624 '''Generator function that provides side-by-side comparison data.'''
626 625 s = difflib.SequenceMatcher(None, leftlines, rightlines)
627 626 if context < 0:
628 yield tmpl.generate('comparisonblock',
629 {'lines': getblock(s.get_opcodes())})
627 l = _getcompblock(tmpl, leftlines, rightlines, s.get_opcodes())
628 yield tmpl.generate('comparisonblock', {'lines': l})
630 629 else:
631 630 for oc in s.get_grouped_opcodes(n=context):
632 yield tmpl.generate('comparisonblock', {'lines': getblock(oc)})
631 l = _getcompblock(tmpl, leftlines, rightlines, oc)
632 yield tmpl.generate('comparisonblock', {'lines': l})
633 633
634 634 def diffstatgen(ctx, basectx):
635 635 '''Generator function that provides the diffstat data.'''
General Comments 0
You need to be logged in to leave comments. Login now