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))
109
115
conflict_handler, merge_factory)
110
116
result = apply_changeset(new_cset, invert_invent(this.inventory),
111
117
this.basedir, conflict_handler, False)
112
conflict_handler.finalize()
117
121
def make_merge_changeset(cset, this, base, other,
221
225
return merge_factory(entry.id, base, other)
223
227
if isinstance(contents, changeset.ReplaceContents):
224
if contents.old_contents is None and contents.new_contents is None:
228
base_contents = contents.old_contents
229
other_contents = contents.new_contents
230
if base_contents is None and other_contents is None:
226
if contents.new_contents is None:
232
if other_contents is None:
227
233
this_contents = get_contents(this, entry.id)
228
234
if this_path is not None and bzrlib.osutils.lexists(this_path):
229
if this_contents != contents.old_contents:
235
if this_contents != base_contents:
230
236
return conflict_handler.rem_contents_conflict(this_path,
231
this_contents, contents.old_contents)
237
this_contents, base_contents)
235
elif contents.old_contents is None:
241
elif base_contents is None:
236
242
if this_path is None or not bzrlib.osutils.lexists(this_path):
239
245
this_contents = get_contents(this, entry.id)
240
if this_contents == contents.new_contents:
246
if this_contents == other_contents:
243
249
conflict_handler.new_contents_conflict(this_path,
245
elif isinstance(contents.old_contents, changeset.TreeFileCreate) and \
246
isinstance(contents.new_contents, changeset.TreeFileCreate):
251
elif isinstance(base_contents, changeset.TreeFileCreate) and \
252
isinstance(other_contents, changeset.TreeFileCreate):
247
253
return make_merge()
249
255
this_contents = get_contents(this, entry.id)
250
if this_contents == contents.old_contents:
256
if this_contents == base_contents:
252
elif this_contents == contents.new_contents:
258
elif this_contents == other_contents:
254
elif contents.old_contents == contents.new_contents:
260
elif base_contents == other_contents:
257
conflict_handler.threeway_contents_conflict(this_path,
258
this_contents, contents.old_contents,
259
contents.new_contents)
263
conflict_handler.threeway_contents_conflict(this_path,
262
269
def make_merged_metadata(entry, base, other):