~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Andrew Bennetts
  • Date: 2008-08-07 00:25:38 UTC
  • mfrom: (3612 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3613.
  • Revision ID: andrew.bennetts@canonical.com-20080807002538-mtl1fcgy2fdabha4
Merge from bzr.dev.

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