1168
1168
file_group.append(trans_id)
1170
1170
def _dump_conflicts(self, name, parent_id, file_id, this_lines=None,
1171
base_lines=None, other_lines=None, set_version=False):
1172
data = (('OTHER', self.other_tree, other_lines),
1173
('THIS', self.this_tree, this_lines),
1174
('BASE', self.base_tree, base_lines))
1171
base_lines=None, other_lines=None, set_version=False,
1173
data = [('OTHER', self.other_tree, other_lines),
1174
('THIS', self.this_tree, this_lines)]
1176
data.append(('BASE', self.base_tree, base_lines))
1175
1177
versioned = False
1176
1178
file_group = []
1177
1179
for suffix, tree, lines in data:
1223
1225
if executability is not None:
1224
1226
trans_id = self.tt.get_trans_id(file_id)
1225
1227
self.tt.set_executability(executability, trans_id)
1229
class WeaveMerger(Merge3Merger):
1230
supports_reprocess = False
1231
supports_show_base = False
1232
def _merged_lines(self, file_id):
1233
"""Generate the merged lines.
1234
There is no distinction between lines that are meant to contain <<<<<<<
1237
if getattr(self.this_tree, 'get_weave', False) is False:
1238
# If we have a WorkingTree, try using the basis
1239
wt_sha1 = self.this_tree.get_file_sha1(file_id)
1240
this_tree = self.this_tree.branch.basis_tree()
1241
if this_tree.get_file_sha1(file_id) != wt_sha1:
1242
raise WorkingTreeNotRevision(self.this_tree)
1244
this_tree = self.this_tree
1245
weave = this_tree.get_weave(file_id)
1246
this_revision_id = this_tree.inventory[file_id].revision
1247
other_revision_id = self.other_tree.inventory[file_id].revision
1248
this_i = weave.lookup(this_revision_id)
1249
other_i = weave.lookup(other_revision_id)
1250
plan = weave.plan_merge(this_i, other_i)
1251
return weave.weave_merge(plan)
1253
def text_merge(self, file_id, trans_id):
1254
lines = self._merged_lines(file_id)
1255
conflicts = '<<<<<<<\n' in lines
1256
self.tt.create_file(lines, trans_id)
1258
self.conflicts.append(('text conflict', (file_id)))
1259
name = self.tt.final_name(trans_id)
1260
parent_id = self.tt.final_parent(trans_id)
1261
file_group = self._dump_conflicts(name, parent_id, file_id,
1263
file_group.append(trans_id)