/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/xml_serializer.py

  • Committer: Robert Collins
  • Date: 2007-10-05 02:41:37 UTC
  • mto: (2592.3.166 repository)
  • mto: This revision was merged to the branch mainline in revision 2896.
  • Revision ID: robertc@robertcollins.net-20071005024137-kn7brcu07nu8cwl1
* The class ``bzrlib.repofmt.knitrepo.KnitRepository3`` has been folded into
  ``KnitRepository`` by parameters to the constructor. (Robert Collins)
* ``bzrlib.xml_serializer.Serializer`` is now responsible for checking that
  mandatory attributes are present on serialisation and deserialisation.
  This fixes some holes in API usage and allows better separation between
  physical storage and object serialisation. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
    def write_inventory_to_string(self, inv):
60
60
        raise NotImplementedError(self.write_inventory_to_string)
61
61
 
62
 
    def read_inventory_from_string(self, xml_string):
 
62
    def read_inventory_from_string(self, xml_string, revision_id=None):
 
63
        """Read xml_string into an inventory object.
 
64
 
 
65
        :param xml_string: The xml to read.
 
66
        :param revision_id: If not-None, the expected revision id of the
 
67
            inventory. Some serialisers use this to set the results' root
 
68
            revision.
 
69
        """
63
70
        try:
64
 
            return self._unpack_inventory(fromstring(xml_string))
 
71
            return self._unpack_inventory(fromstring(xml_string), revision_id)
65
72
        except ParseError, e:
66
73
            raise errors.UnexpectedInventoryFormat(e)
67
74
 
68
 
    def read_inventory(self, f):
 
75
    def read_inventory(self, f, revision_id=None):
69
76
        try:
70
 
            return self._unpack_inventory(self._read_element(f))
 
77
            return self._unpack_inventory(self._read_element(f),
 
78
                revision_id=None)
71
79
        except ParseError, e:
72
80
            raise errors.UnexpectedInventoryFormat(e)
73
81