213
213
unique_add(self._new_id, trans_id, file_id)
214
214
unique_add(self._r_new_id, file_id, trans_id)
216
def cancel_versioning(self, trans_id):
217
"""Undo a previous versioning of a file"""
218
file_id = self._new_id[trans_id]
219
del self._new_id[trans_id]
220
del self._r_new_id[file_id]
216
222
def new_paths(self):
217
223
"""Determine the paths of all new and changed files"""
942
948
self.tt = TreeTransform(working_tree)
944
950
for file_id in all_ids:
951
self.merge_names(file_id)
945
952
file_status = self.merge_contents(file_id)
946
953
self.merge_executable(file_id, file_status)
999
1010
assert key_this == key_base
1013
def merge_names(self, file_id):
1014
def get_entry(tree):
1015
if file_id in tree.inventory:
1016
return tree.inventory[file_id]
1019
this_entry = get_entry(self.this_tree)
1020
other_entry = get_entry(self.other_tree)
1021
base_entry = get_entry(self.base_tree)
1022
name_winner = self.scalar_three_way(this_entry, base_entry,
1023
other_entry, file_id, self.name)
1024
parent_id_winner = self.scalar_three_way(this_entry, base_entry,
1025
other_entry, file_id,
1027
if this_entry is None:
1028
if name_winner == "this":
1029
name_winner = "other"
1030
if parent_id_winner == "this":
1031
parent_id_winner = "other"
1032
if name_winner == "this" and parent_id_winner == "this":
1034
if other_entry is None:
1035
# it doesn't matter whether the result was 'other' or
1036
# 'conflict'-- if there's no 'other', we leave it alone.
1038
# if we get here, name_winner and parent_winner are set to safe values.
1039
winner_entry = {"this": this_entry, "other": other_entry,
1040
"conflict": other_entry}
1041
trans_id = self.tt.get_trans_id(file_id)
1042
parent_id = winner_entry[parent_id_winner].parent_id
1043
parent_trans_id = self.tt.get_trans_id(parent_id)
1044
self.tt.adjust_path(winner_entry[name_winner].name, parent_trans_id,
1002
1048
def merge_contents(self, file_id):
1003
1049
def contents_pair(tree):
1004
1050
if file_id not in tree:
1040
1086
self.text_merge(file_id, trans_id)
1041
1087
return "modified"
1043
trans_id = self.tt.get_id_tree(file_id)
1089
trans_id = self.tt.get_trans_id(file_id)
1044
1090
name = self.tt.final_name(trans_id)
1045
1091
parent_id = self.tt.final_parent(trans_id)
1046
1092
if file_id in self.this_tree.inventory:
1047
1093
self.tt.unversion_file(trans_id)
1048
1094
self.tt.delete_contents(trans_id)
1096
self.tt.cancel_versioning(trans_id)
1049
1097
file_group = self._dump_conflicts(name, parent_id, file_id,
1050
1098
set_version=True)