~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

  • Committer: Robert Collins
  • Date: 2007-10-05 03:14:29 UTC
  • mfrom: (2889.1.1 knit-repo)
  • mto: This revision was merged to the branch mainline in revision 2933.
  • Revision ID: robertc@robertcollins.net-20071005031429-8zab3gybvpicu52l
Merge KnitRepository3 removal branch.

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):