|
a/Allura/allura/lib/patience.py |
|
b/Allura/allura/lib/patience.py |
|
... |
|
... |
146 |
|
146 |
|
147 |
def unified_diff(
|
147 |
def unified_diff(
|
148 |
a, b, fromfile='', tofile='', fromfiledate='',
|
148 |
a, b, fromfile='', tofile='', fromfiledate='',
|
149 |
tofiledate='', n=3, lineterm='\n'):
|
149 |
tofiledate='', n=3, lineterm='\n'):
|
150 |
started = False
|
150 |
started = False
|
151 |
for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n):
|
151 |
for group in difflib.SequenceMatcher(None,a,b).get_grouped_opcodes(n):
|
152 |
if not started:
|
152 |
if not started:
|
153 |
yield '--- %s %s%s' % (fromfile, fromfiledate, lineterm)
|
153 |
yield '--- %s %s%s' % (fromfile, fromfiledate, lineterm)
|
154 |
yield '+++ %s %s%s' % (tofile, tofiledate, lineterm)
|
154 |
yield '+++ %s %s%s' % (tofile, tofiledate, lineterm)
|
155 |
started = True
|
155 |
started = True
|
156 |
i1, i2, j1, j2 = group[0][1], group[-1][2], group[0][3], group[-1][4]
|
156 |
i1, i2, j1, j2 = group[0][1], group[-1][2], group[0][3], group[-1][4]
|