/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

Merge with __contains__

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
    BzrCheckError,
51
51
    BzrError,
52
52
    )
53
 
from bzrlib.symbol_versioning import deprecated_method
 
53
from bzrlib.symbol_versioning import deprecated_in, deprecated_method
54
54
from bzrlib.trace import mutter
55
55
 
56
56
 
176
176
                    candidates[ie.revision] = ie
177
177
        return candidates
178
178
 
 
179
    @deprecated_method(deprecated_in((1, 6, 0)))
179
180
    def get_tar_item(self, root, dp, now, tree):
180
181
        """Get a tarfile item and a file stream for its content."""
181
182
        item = tarfile.TarInfo(osutils.pathjoin(root, dp).encode('utf8'))
238
239
        raise BzrError("don't know how to export {%s} of kind %r" %
239
240
                       (self.file_id, self.kind))
240
241
 
 
242
    @deprecated_method(deprecated_in((1, 6, 0)))
241
243
    def put_on_disk(self, dest, dp, tree):
242
244
        """Create a representation of self on disk in the prefix dest.
243
245
        
813
815
                # adds come later
814
816
                continue
815
817
            # Preserve unaltered children of file_id for later reinsertion.
816
 
            children[file_id] = getattr(self[file_id], 'children', {})
 
818
            file_id_children = getattr(self[file_id], 'children', {})
 
819
            if len(file_id_children):
 
820
                children[file_id] = file_id_children
817
821
            # Remove file_id and the unaltered children. If file_id is not
818
822
            # being deleted it will be reinserted back later.
819
823
            self.remove_recursive_id(file_id)
825
829
        for new_path, new_entry in sorted((np, e) for op, np, f, e in
826
830
                                          delta if np is not None):
827
831
            if new_entry.kind == 'directory':
828
 
                new_entry.children = children.get(new_entry.file_id, {})
 
832
                # Pop the child which to allow detection of children whose
 
833
                # parents were deleted and which were not reattached to a new
 
834
                # parent.
 
835
                new_entry.children = children.pop(new_entry.file_id, {})
829
836
            self.add(new_entry)
 
837
        if len(children):
 
838
            # Get the parent id that was deleted
 
839
            parent_id, children = children.popitem()
 
840
            raise errors.InconsistentDelta("<deleted>", parent_id,
 
841
                "The file id was deleted but its children were not deleted.")
830
842
 
831
843
    def _set_root(self, ie):
832
844
        self.root = ie
838
850
        if self.root is None:
839
851
            return Inventory(root_id=None)
840
852
        other = Inventory(entries.next()[1].file_id)
 
853
        other.root.revision = self.root.revision
841
854
        # copy recursively so we know directories will be added before
842
855
        # their children.  There are more efficient ways than this...
843
856
        for path, entry in entries: