~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/serializer.py

  • Committer: John Arbash Meinel
  • Date: 2010-02-10 17:52:08 UTC
  • mfrom: (5021 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5023.
  • Revision ID: john@arbash-meinel.com-20100210175208-bubuwav4uqigu291
Merge bzr.dev 5021 to resolve NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    squashes_xml_invalid_characters = False
28
28
 
29
29
    def write_inventory(self, inv, f):
30
 
        """Write inventory to a file"""
 
30
        """Write inventory to a file.
 
31
 
 
32
        Note: this is a *whole inventory* operation, and should only be used
 
33
        sparingly, as it does not scale well with large trees.
 
34
        """
31
35
        raise NotImplementedError(self.write_inventory)
32
36
 
33
37
    def write_inventory_to_string(self, inv):
 
38
        """Produce a simple string representation of an inventory.
 
39
 
 
40
        Note: this is a *whole inventory* operation, and should only be used
 
41
        sparingly, as it does not scale well with large trees.
 
42
 
 
43
        The requirement for the contents of the string is that it can be passed
 
44
        to read_inventory_from_string and the result is an identical inventory
 
45
        in memory.
 
46
 
 
47
        (All serializers as of 2009-07-29 produce XML, but this is not mandated
 
48
        by the interface.)
 
49
        """
34
50
        raise NotImplementedError(self.write_inventory_to_string)
35
51
 
36
52
    def read_inventory_from_string(self, string, revision_id=None,
37
 
                                   entry_cache=None):
 
53
                                   entry_cache=None, return_from_cache=False):
38
54
        """Read string into an inventory object.
39
55
 
40
56
        :param string: The serialized inventory to read.
48
64
        :param entry_cache: An optional cache of InventoryEntry objects. If
49
65
            supplied we will look up entries via (file_id, revision_id) which
50
66
            should map to a valid InventoryEntry (File/Directory/etc) object.
 
67
        :param return_from_cache: Return entries directly from the cache,
 
68
            rather than copying them first. This is only safe if the caller
 
69
            promises not to mutate the returned inventory entries, but it can
 
70
            make some operations significantly faster.
51
71
        """
52
72
        raise NotImplementedError(self.read_inventory_from_string)
53
73
 
54
74
    def read_inventory(self, f, revision_id=None):
 
75
        """See read_inventory_from_string."""
55
76
        raise NotImplementedError(self.read_inventory)
56
77
 
57
78
    def write_revision(self, rev, f):