/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/xml5.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:
154
154
    supported_kinds = set(['file', 'directory', 'symlink'])
155
155
    format_num = '5'
156
156
 
 
157
    def _check_revisions(self, inv):
 
158
        """Extension point for subclasses to check during serialisation.
 
159
 
 
160
        By default no checking is done.
 
161
 
 
162
        :param inv: An inventory about to be serialised, to be checked.
 
163
        :raises: AssertionError if an error has occured.
 
164
        """
 
165
 
157
166
    def write_inventory_to_lines(self, inv):
158
167
        """Return a list of lines with the encoded inventory."""
159
168
        return self.write_inventory(inv, None)
179
188
        :return: The inventory as a list of lines.
180
189
        """
181
190
        _ensure_utf8_re()
 
191
        self._check_revisions(inv)
182
192
        output = []
183
193
        append = output.append
184
194
        self._append_inventory_root(append, inv)
326
336
            prop_elt.tail = '\n'
327
337
        top_elt.tail = '\n'
328
338
 
329
 
    def _unpack_inventory(self, elt):
 
339
    def _unpack_inventory(self, elt, revision_id):
330
340
        """Construct from XML Element
331
341
        """
332
342
        assert elt.tag == 'inventory'
347
357
            if ie.parent_id is None:
348
358
                ie.parent_id = root_id
349
359
            inv.add(ie)
 
360
        if revision_id is not None:
 
361
            inv.root.revision = revision_id
350
362
        return inv
351
363
 
352
364
    def _unpack_entry(self, elt):