~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

Late bind to PatienceSequenceMatcher in merge3.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python
2
 
 
3
1
# This program is free software; you can redistribute it and/or modify
4
2
# it under the terms of the GNU General Public License as published by
5
3
# the Free Software Foundation; either version 2 of the License, or
15
13
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
14
 
17
15
 
18
 
from bzrlib.xml import ElementTree, SubElement, Element, Serializer
 
16
from bzrlib.xml_serializer import ElementTree, SubElement, Element, Serializer
19
17
from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
20
18
import bzrlib.inventory as inventory
21
19
from bzrlib.revision import Revision        
37
35
        e.text = '\n'
38
36
        if inv.root.file_id not in (None, ROOT_ID):
39
37
            e.set('file_id', inv.root.file_id)
 
38
        if inv.revision_id is not None:
 
39
            e.set('revision_id', inv.revision_id)
40
40
        for path, ie in inv.iter_entries():
41
41
            e.append(self._pack_entry(ie))
42
42
        return e
44
44
 
45
45
    def _pack_entry(self, ie):
46
46
        """Convert InventoryEntry to XML element"""
 
47
        # TODO: should just be a plain assertion
47
48
        if not InventoryEntry.versionable_kind(ie.kind):
48
49
            raise AssertionError('unsupported entry kind %s' % ie.kind)
49
50
        e = Element(ie.kind)
123
124
            if format != '5':
124
125
                raise BzrError("invalid format version %r on inventory"
125
126
                                % format)
126
 
        inv = Inventory(root_id)
 
127
        revision_id = elt.get('revision_id')
 
128
        inv = Inventory(root_id, revision_id=revision_id)
127
129
        for e in elt:
128
130
            ie = self._unpack_entry(e)
129
131
            if ie.parent_id == ROOT_ID: