Show More
@@ -622,16 +622,21 b' def _getcompblock(leftlines, rightlines,' | |||
|
622 | 622 | return templateutil.mappinggenerator(_getcompblockgen, args=args, |
|
623 | 623 | name='comparisonline') |
|
624 | 624 | |
|
625 |
def compare( |
|
|
625 | def _comparegen(context, contextnum, leftlines, rightlines): | |
|
626 | 626 | '''Generator function that provides side-by-side comparison data.''' |
|
627 | 627 | s = difflib.SequenceMatcher(None, leftlines, rightlines) |
|
628 | 628 | if contextnum < 0: |
|
629 | 629 | l = _getcompblock(leftlines, rightlines, s.get_opcodes()) |
|
630 |
yield |
|
|
630 | yield {'lines': l} | |
|
631 | 631 | else: |
|
632 | 632 | for oc in s.get_grouped_opcodes(n=contextnum): |
|
633 | 633 | l = _getcompblock(leftlines, rightlines, oc) |
|
634 |
yield |
|
|
634 | yield {'lines': l} | |
|
635 | ||
|
636 | def compare(tmpl, contextnum, leftlines, rightlines): | |
|
637 | args = (contextnum, leftlines, rightlines) | |
|
638 | return templateutil.mappinggenerator(_comparegen, args=args, | |
|
639 | name='comparisonblock') | |
|
635 | 640 | |
|
636 | 641 | def diffstatgen(ctx, basectx): |
|
637 | 642 | '''Generator function that provides the diffstat data.''' |
General Comments 0
You need to be logged in to leave comments.
Login now