~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-21 12:53:02 UTC
  • mto: This revision was merged to the branch mainline in revision 6519.
  • Revision ID: jelmer@samba.org-20120221125302-uhxdc14iays7k5wq
Add Tree.iter_child_entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
        we look for a file with the same name in that directory.
128
128
        Else, we look for an entry in the base tree with the same path.
129
129
        """
130
 
 
131
130
        if self.base_tree.has_id(parent_ie.file_id):
132
 
            # FIXME: Handle nested trees
133
 
            base_parent_ie = self.base_tree.root_inventory[parent_ie.file_id]
134
 
            base_child_ie = base_parent_ie.children.get(
 
131
            base_path = osutils.pathjoin(
 
132
                self.base_tree.id2path(parent_ie.file_id),
135
133
                osutils.basename(path))
136
 
            if base_child_ie is not None:
137
 
                return (base_child_ie.file_id,
138
 
                        self.base_tree.id2path(base_child_ie.file_id))
 
134
            base_id = self.base_tree.path2id(base_path)
 
135
            if base_id is not None:
 
136
                return (base_id, base_path)
139
137
        full_base_path = osutils.pathjoin(self.base_path, path)
140
138
        # This may return None, but it is our last attempt
141
139
        return self.base_tree.path2id(full_base_path), full_base_path