~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-23 19:45:15 UTC
  • mto: This revision was merged to the branch mainline in revision 6486.
  • Revision ID: jelmer@samba.org-20120223194515-1ctgfzj362m0tu0k
Use bzrdir.controldir for generic access to control directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
940
940
        result = []
941
941
        walker = _mod_tree.MultiWalker(self.other_tree, self._lca_trees)
942
942
 
943
 
        base_inventory = self.base_tree.inventory
944
 
        this_inventory = self.this_tree.inventory
 
943
        base_inventory = self.base_tree.root_inventory
 
944
        this_inventory = self.this_tree.root_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:
1091
1091
        other_root = self.tt.trans_id_file_id(other_root_file_id)
1092
1092
        if other_root == self.tt.root:
1093
1093
            return
1094
 
        if self.this_tree.inventory.has_id(
1095
 
            self.other_tree.inventory.root.file_id):
 
1094
        if self.this_tree.has_id(
 
1095
            self.other_tree.get_root_id()):
1096
1096
            # the other tree's root is a non-root in the current tree (as
1097
1097
            # when a previously unrelated branch is merged into another)
1098
1098
            return
1260
1260
 
1261
1261
    def merge_names(self, file_id):
1262
1262
        def get_entry(tree):
1263
 
            if tree.has_id(file_id):
1264
 
                return tree.inventory[file_id]
1265
 
            else:
 
1263
            try:
 
1264
                return tree.root_inventory[file_id]
 
1265
            except errors.NoSuchId:
1266
1266
                return None
1267
1267
        this_entry = get_entry(self.this_tree)
1268
1268
        other_entry = get_entry(self.other_tree)
1940
1940
 
1941
1941
    def _entries_to_incorporate(self):
1942
1942
        """Yields pairs of (inventory_entry, new_parent)."""
1943
 
        other_inv = self.other_tree.inventory
 
1943
        other_inv = self.other_tree.root_inventory
1944
1944
        subdir_id = other_inv.path2id(self._source_subpath)
1945
1945
        if subdir_id is None:
1946
1946
            # XXX: The error would be clearer if it gave the URL of the source
1948
1948
            raise PathNotInTree(self._source_subpath, "Source tree")
1949
1949
        subdir = other_inv[subdir_id]
1950
1950
        parent_in_target = osutils.dirname(self._target_subdir)
1951
 
        target_id = self.this_tree.inventory.path2id(parent_in_target)
 
1951
        target_id = self.this_tree.path2id(parent_in_target)
1952
1952
        if target_id is None:
1953
1953
            raise PathNotInTree(self._target_subdir, "Target tree")
1954
1954
        name_in_target = osutils.basename(self._target_subdir)
1955
1955
        merge_into_root = subdir.copy()
1956
1956
        merge_into_root.name = name_in_target
1957
 
        if self.this_tree.inventory.has_id(merge_into_root.file_id):
 
1957
        if self.this_tree.has_id(merge_into_root.file_id):
1958
1958
            # Give the root a new file-id.
1959
1959
            # This can happen fairly easily if the directory we are
1960
1960
            # incorporating is the root, and both trees have 'TREE_ROOT' as