11
11
"""Contents-change wrapper around merge3.Merge3"""
12
def __init__(self, file_id, base, other):
12
def __init__(self, file_id, base, other, show_base=False):
13
13
self.file_id = file_id
16
self.show_base = show_base
17
18
def is_creation(self):
49
50
new_conflicts = False
50
51
output_file = file(new_file, "wb")
51
52
start_marker = "!START OF MERGE CONFLICT!" + "I HOPE THIS IS UNIQUE"
53
if self.show_base is True:
52
57
for line in m3.merge_lines(name_a = "TREE", name_b = "MERGE-SOURCE",
53
start_marker=start_marker):
58
name_base = "BASE-REVISION",
59
start_marker=start_marker, base_marker=base_marker):
54
60
if line.startswith(start_marker):
55
61
new_conflicts = True
56
62
output_file.write(line.replace(start_marker, '<' * 7))
221
227
return merge_factory(entry.id, base, other)
223
229
if isinstance(contents, changeset.ReplaceContents):
224
if contents.old_contents is None and contents.new_contents is None:
230
base_contents = contents.old_contents
231
other_contents = contents.new_contents
232
if base_contents is None and other_contents is None:
226
if contents.new_contents is None:
234
if other_contents is None:
227
235
this_contents = get_contents(this, entry.id)
228
236
if this_path is not None and bzrlib.osutils.lexists(this_path):
229
if this_contents != contents.old_contents:
237
if this_contents != base_contents:
230
238
return conflict_handler.rem_contents_conflict(this_path,
231
this_contents, contents.old_contents)
239
this_contents, base_contents)
235
elif contents.old_contents is None:
243
elif base_contents is None:
236
244
if this_path is None or not bzrlib.osutils.lexists(this_path):
239
247
this_contents = get_contents(this, entry.id)
240
if this_contents == contents.new_contents:
248
if this_contents == other_contents:
243
251
conflict_handler.new_contents_conflict(this_path,
245
elif isinstance(contents.old_contents, changeset.TreeFileCreate) and \
246
isinstance(contents.new_contents, changeset.TreeFileCreate):
253
elif isinstance(base_contents, changeset.TreeFileCreate) and \
254
isinstance(other_contents, changeset.TreeFileCreate):
247
255
return make_merge()
249
257
this_contents = get_contents(this, entry.id)
250
if this_contents == contents.old_contents:
258
if this_contents == base_contents:
252
elif this_contents == contents.new_contents:
260
elif this_contents == other_contents:
254
elif contents.old_contents == contents.new_contents:
262
elif base_contents == other_contents:
257
conflict_handler.threeway_contents_conflict(this_path,
258
this_contents, contents.old_contents,
259
contents.new_contents)
265
conflict_handler.threeway_contents_conflict(this_path,
262
271
def make_merged_metadata(entry, base, other):