481
481
base_pair = contents_pair(self.base_tree)
482
482
other_pair = contents_pair(self.other_tree)
483
483
if base_pair == other_pair:
484
# OTHER introduced no changes
484
485
return "unmodified"
485
486
this_pair = contents_pair(self.this_tree)
486
487
if this_pair == other_pair:
488
# THIS and OTHER introduced the same changes
487
489
return "unmodified"
489
491
trans_id = self.tt.get_trans_id(file_id)
490
492
if this_pair == base_pair:
493
# only OTHER introduced changes
491
494
if file_id in self.this_tree:
495
# Remove any existing contents
492
496
self.tt.delete_contents(trans_id)
493
497
if file_id in self.other_tree.inventory:
498
# OTHER changed the file
494
499
create_by_entry(self.tt,
495
500
self.other_tree.inventory[file_id],
496
501
self.other_tree, trans_id)
497
self.tt.version_file(file_id, trans_id)
502
if file_id not in self.this_tree:
503
self.tt.version_file(file_id, trans_id)
498
504
return "modified"
499
if file_id in self.this_tree:
505
elif file_id in self.this_tree:
506
# OTHER deleted the file
500
507
self.tt.unversion_file(trans_id)
509
#BOTH THIS and OTHER introduced changes; scalar conflict
502
510
elif this_pair[0] == "file" and other_pair[0] == "file":
503
# If this and other are both files, either base is a file, or
504
# both converted to files, so at least we have agreement that
505
# output should be a file.
506
self.tt.version_file(file_id, trans_id)
511
# THIS and OTHER are both files, so text merge. Either
512
# BASE is a file, or both converted to files, so at least we
513
# have agreement that output should be a file.
514
if file_id not in self.this_tree:
515
self.tt.version_file(file_id, trans_id)
507
516
self.text_merge(file_id, trans_id)
508
517
return "modified"
519
# Scalar conflict, can't text merge. Dump conflicts
510
520
trans_id = self.tt.get_trans_id(file_id)
511
521
name = self.tt.final_name(trans_id)
512
522
parent_id = self.tt.final_parent(trans_id)