941
941
walker = _mod_tree.MultiWalker(self.other_tree, self._lca_trees)
943
base_inventory = self.base_tree.root_inventory
944
this_inventory = self.this_tree.root_inventory
943
base_inventory = self.base_tree.inventory
944
this_inventory = self.this_tree.inventory
945
945
for path, file_id, other_ie, lca_values in walker.iter_all():
946
946
# Is this modified at all from any of the other trees?
947
947
if other_ie is None:
1081
@deprecated_method(deprecated_in((2, 4, 0)))
1083
if self.tt.final_kind(self.tt.root) is None:
1084
self.tt.cancel_deletion(self.tt.root)
1085
if self.tt.final_file_id(self.tt.root) is None:
1086
self.tt.version_file(self.tt.tree_file_id(self.tt.root),
1088
other_root_file_id = self.other_tree.get_root_id()
1089
if other_root_file_id is None:
1091
other_root = self.tt.trans_id_file_id(other_root_file_id)
1092
if other_root == self.tt.root:
1094
if self.this_tree.has_id(
1095
self.other_tree.get_root_id()):
1096
# the other tree's root is a non-root in the current tree (as
1097
# when a previously unrelated branch is merged into another)
1099
if self.tt.final_kind(other_root) is not None:
1100
other_root_is_present = True
1102
# other_root doesn't have a physical representation. We still need
1103
# to move any references to the actual root of the tree.
1104
other_root_is_present = False
1105
# 'other_tree.inventory.root' is not present in this tree. We are
1106
# calling adjust_path for children which *want* to be present with a
1107
# correct place to go.
1108
for _, child in self.other_tree.inventory.root.children.iteritems():
1109
trans_id = self.tt.trans_id_file_id(child.file_id)
1110
if not other_root_is_present:
1111
if self.tt.final_kind(trans_id) is not None:
1112
# The item exist in the final tree and has a defined place
1115
# Move the item into the root
1117
final_name = self.tt.final_name(trans_id)
1118
except errors.NoFinalPath:
1119
# This file is not present anymore, ignore it.
1121
self.tt.adjust_path(final_name, self.tt.root, trans_id)
1122
if other_root_is_present:
1123
self.tt.cancel_creation(other_root)
1124
self.tt.cancel_versioning(other_root)
1081
1126
def write_modified(self, results):
1082
1127
modified_hashes = {}
1083
1128
for path in results.modified_paths:
1193
1238
# At this point, the lcas disagree, and the tip disagree
1194
1239
return 'conflict'
1242
@deprecated_method(deprecated_in((2, 2, 0)))
1243
def scalar_three_way(this_tree, base_tree, other_tree, file_id, key):
1244
"""Do a three-way test on a scalar.
1245
Return "this", "other" or "conflict", depending whether a value wins.
1247
key_base = key(base_tree, file_id)
1248
key_other = key(other_tree, file_id)
1249
#if base == other, either they all agree, or only THIS has changed.
1250
if key_base == key_other:
1252
key_this = key(this_tree, file_id)
1253
# "Ambiguous clean merge"
1254
if key_this == key_other:
1256
elif key_this == key_base:
1196
1261
def merge_names(self, file_id):
1197
1262
def get_entry(tree):
1199
return tree.root_inventory[file_id]
1200
except errors.NoSuchId:
1263
if tree.has_id(file_id):
1264
return tree.inventory[file_id]
1202
1267
this_entry = get_entry(self.this_tree)
1203
1268
other_entry = get_entry(self.other_tree)
1876
1941
def _entries_to_incorporate(self):
1877
1942
"""Yields pairs of (inventory_entry, new_parent)."""
1878
other_inv = self.other_tree.root_inventory
1943
other_inv = self.other_tree.inventory
1879
1944
subdir_id = other_inv.path2id(self._source_subpath)
1880
1945
if subdir_id is None:
1881
1946
# XXX: The error would be clearer if it gave the URL of the source