626
626
def associated_filenames(self):
627
627
return [self.path + suffix for suffix in CONFLICT_SUFFIXES]
629
def _resolve(self, tt, winner_suffix):
630
"""Resolve the conflict by copying one of .THIS or .OTHER into file.
632
:param tt: The TreeTransform where the conflict is resolved.
633
:param winner_suffix: Either 'THIS' or 'OTHER'
635
The resolution is symmetric, when taking THIS, item.THIS is renamed
636
into item and vice-versa. This takes one of the files as a whole
637
ignoring every difference that could have been merged cleanly.
639
# To avoid useless copies, we switch item and item.winner_suffix, only
640
# item will exist after the conflict has been resolved anyway.
641
item_tid = tt.trans_id_file_id(self.file_id)
642
item_parent_tid = tt.get_tree_parent(item_tid)
643
winner_path = self.path + '.' + winner_suffix
644
winner_tid = tt.trans_id_tree_path(winner_path)
645
winner_parent_tid = tt.get_tree_parent(winner_tid)
646
# Switch the paths to preserve the content
647
tt.adjust_path(self.path, winner_parent_tid, winner_tid)
648
tt.adjust_path(winner_path, item_parent_tid, item_tid)
649
# Associate the file_id to the right content
650
tt.unversion_file(item_tid)
651
tt.version_file(self.file_id, winner_tid)
654
def action_take_this(self, tree):
655
self._resolve_with_cleanups(tree, 'THIS')
657
def action_take_other(self, tree):
658
self._resolve_with_cleanups(tree, 'OTHER')
630
661
class HandledConflict(Conflict):
631
662
"""A path problem that has been provisionally resolved.