1042
1042
other_root = self.tt.trans_id_file_id(other_root_file_id)
1043
1043
if other_root == self.tt.root:
1045
if self.other_tree.inventory.root.file_id in self.this_tree.inventory:
1046
# the other tree's root is a non-root in the current tree (as when
1047
# a previously unrelated branch is merged into another)
1046
1050
self.tt.final_kind(other_root)
1051
other_root_is_present = True
1047
1052
except errors.NoSuchFile:
1049
if self.this_tree.has_id(self.other_tree.inventory.root.file_id):
1050
# the other tree's root is a non-root in the current tree
1052
self.reparent_children(self.other_tree.inventory.root, self.tt.root)
1053
self.tt.cancel_creation(other_root)
1054
self.tt.cancel_versioning(other_root)
1056
def reparent_children(self, ie, target):
1057
for thing, child in ie.children.iteritems():
1053
# other_root doesn't have a physical representation. We still need
1054
# to move any references to the actual root of the tree.
1055
other_root_is_present = False
1056
# 'other_tree.inventory.root' is not present in this tree. We are
1057
# calling adjust_path for children which *want* to be present with a
1058
# correct place to go.
1059
for thing, child in self.other_tree.inventory.root.children.iteritems():
1058
1060
trans_id = self.tt.trans_id_file_id(child.file_id)
1059
self.tt.adjust_path(self.tt.final_name(trans_id), target, trans_id)
1061
if not other_root_is_present:
1062
# FIXME: Make final_kind returns None instead of raising
1063
# NoSuchFile to avoid the ugly construct below -- vila 20100402
1065
self.tt.final_kind(trans_id)
1066
# The item exist in the final tree and has a defined place
1069
except errors.NoSuchFile, e:
1071
# Move the item into the root
1072
self.tt.adjust_path(self.tt.final_name(trans_id),
1073
self.tt.root, trans_id)
1074
if other_root_is_present:
1075
self.tt.cancel_creation(other_root)
1076
self.tt.cancel_versioning(other_root)
1061
1078
def write_modified(self, results):
1062
1079
modified_hashes = {}