92
92
yield (revno_str, author, date_str, origin, text)
95
def reannotate(parent_lines, new_lines, new_revision_id):
95
def reannotate(parents_lines, new_lines, new_revision_id):
96
96
"""Create a new annotated version from new lines and parent annotations.
98
:param parent_lines: The annotated lines from the parent
98
:param parents_lines: List of annotated lines for all parents
99
99
:param new_lines: The un-annotated new lines
100
100
:param new_revision_id: The revision-id to associate with new lines
101
101
(will often be CURRENT_REVISION)
103
if len(parents_lines) == 1:
104
for data in _reannotate(parents_lines[0], new_lines, new_revision_id):
107
reannotations = [list(_reannotate(p, new_lines, new_revision_id)) for
109
for annos in zip(*reannotations):
110
origins = set(a for a, l in annos)
112
if len(origins) == 1:
113
yield iter(origins).next(), line
114
elif len(origins) == 2 and new_revision_id in origins:
115
yield (x for x in origins if x != new_revision_id).next(), line
117
yield new_revision_id, line
120
def _reannotate(parent_lines, new_lines, new_revision_id):
103
121
plain_parent_lines = [l for r, l in parent_lines]
104
122
import patiencediff
105
123
patiencediff.PatienceSequenceMatcher()