899
899
if child_entry.kind == 'directory':
900
900
add_children(inventory, child_entry)
901
901
if other_tree.get_root_id() == self.get_root_id():
902
raise errors.BadSubsumeSource(self, other_tree,
902
raise errors.BadSubsumeSource(self, other_tree,
903
903
'Trees have the same root')
905
905
other_tree_path = self.relpath(other_tree.basedir)
906
906
except errors.PathNotChild:
907
raise errors.BadSubsumeSource(self, other_tree,
907
raise errors.BadSubsumeSource(self, other_tree,
908
908
'Tree is not contained by the other')
909
909
new_root_parent = self.path2id(osutils.dirname(other_tree_path))
910
910
if new_root_parent is None:
911
raise errors.BadSubsumeSource(self, other_tree,
911
raise errors.BadSubsumeSource(self, other_tree,
912
912
'Parent directory is not versioned.')
913
913
# We need to ensure that the result of a fetch will have a
914
914
# versionedfile for the other_tree root, and only fetching into
917
917
raise errors.SubsumeTargetNeedsUpgrade(other_tree)
918
918
other_tree.lock_tree_write()
920
for parent_id in other_tree.get_parent_ids():
921
self.branch.fetch(other_tree.branch, parent_id)
922
self.add_parent_tree_id(parent_id)
920
new_parents = other_tree.get_parent_ids()
923
921
other_root = other_tree.inventory.root
924
922
other_root.parent_id = new_root_parent
925
923
other_root.name = osutils.basename(other_tree_path)
926
924
self.inventory.add(other_root)
927
925
add_children(self.inventory, other_root)
928
926
self._write_inventory(self.inventory)
927
for parent_id in other_tree.get_parent_ids():
928
self.branch.fetch(other_tree.branch, parent_id)
929
self.add_parent_tree_id(parent_id)
930
931
other_tree.unlock()
931
932
other_tree.bzrdir.destroy_workingtree_metadata()
950
951
sub_path = self.id2path(file_id)
951
952
branch_transport = mkdirs(sub_path)
952
953
if format is None:
953
format = bzrdir.format_registry.make_bzrdir('experimental-knit2')
954
format = bzrdir.format_registry.make_bzrdir('dirstate-with-subtree')
955
956
branch_transport.mkdir('.')
956
957
except errors.FileExists: