128
127
def line_delta_iter(self, new_lines):
129
128
"""Generate line-based delta from this content to new_lines."""
132
131
s = KnitSequenceMatcher(None, old_texts, new_texts)
132
for tag, i1, i2, j1, j2 in s.get_opcodes():
137
yield (op[1], op[2], op[4]-op[3], new_lines._lines[op[3]:op[4]])
135
# ofrom, oto, length, data
136
yield i1, i2, j2 - j1, new_lines._lines[j1:j2]
139
138
def line_delta(self, new_lines):
140
139
return list(self.line_delta_iter(new_lines))