/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 bzr.dev r4164

Show diffs side-by-side

added added

removed removed

Lines of Context:
489
489
                checker.repeated_text_cnt += 1
490
490
                return
491
491
 
492
 
        mutter('check version {%s} of {%s}', tree_revision_id, self.file_id)
493
492
        checker.checked_text_cnt += 1
494
493
        # We can't check the length, because Weave doesn't store that
495
494
        # information, and the whole point of looking at the weave's
771
770
        self.revision_id = revision_id
772
771
 
773
772
    def __repr__(self):
774
 
        return "<Inventory object at %x, contents=%r>" % (id(self), self._byid)
 
773
        # More than one page of ouput is not useful anymore to debug
 
774
        max_len = 2048
 
775
        closing = '...}'
 
776
        contents = repr(self._byid)
 
777
        if len(contents) > max_len:
 
778
            contents = contents[:(max_len-len(closing))] + closing
 
779
        return "<Inventory object at %x, contents=%r>" % (id(self), contents)
775
780
 
776
781
    def apply_delta(self, delta):
777
782
        """Apply a delta to this inventory.
806
811
            change regardless. E.g. in the recursive deletion of a directory -
807
812
            the directory's children must be included in the delta, or the
808
813
            final inventory will be invalid.
 
814
 
 
815
            Note that a file_id must only appear once within a given delta.
 
816
            An AssertionError is raised otherwise.
809
817
        """
 
818
        # Check that the delta is legal. It would be nice if this could be
 
819
        # done within the loops below but it's safer to validate the delta
 
820
        # before starting to mutate the inventory.
 
821
        unique_file_ids = set([f for _, _, f, _ in delta])
 
822
        if len(unique_file_ids) != len(delta):
 
823
            raise AssertionError("a file-id appears multiple times in %r"
 
824
                    % (delta,))
 
825
        del unique_file_ids
 
826
 
810
827
        children = {}
811
828
        # Remove all affected items which were in the original inventory,
812
829
        # starting with the longest paths, thus ensuring parents are examined