~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

  • Committer: Robert Collins
  • Date: 2005-10-04 04:49:21 UTC
  • Revision ID: robertc@robertcollins.net-20051004044921-45fd2dc3f70abe59
remove debug print statement

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    
36
36
    def _pack_inventory(self, inv):
37
37
        """Convert to XML Element"""
38
 
        e = Element('inventory',
39
 
                    format='5')
 
38
        e = Element('inventory')
40
39
        e.text = '\n'
41
40
        if inv.root.file_id not in (None, ROOT_ID):
42
41
            e.set('file_id', inv.root.file_id)
83
82
                       timestamp = '%.9f' % rev.timestamp,
84
83
                       revision_id = rev.revision_id,
85
84
                       inventory_sha1 = rev.inventory_sha1,
86
 
                       format='5',
87
85
                       )
88
86
        if rev.timezone:
89
87
            root.set('timezone', str(rev.timezone))
90
88
        root.text = '\n'
 
89
 
91
90
        msg = SubElement(root, 'message')
92
91
        msg.text = rev.message
93
92
        msg.tail = '\n'
 
93
 
94
94
        if rev.parent_ids:
95
95
            pelts = SubElement(root, 'parents')
96
96
            pelts.tail = pelts.text = '\n'
100
100
                p.tail = '\n'
101
101
                p.set('revision_id', parent_id)
102
102
        return root
 
103
 
103
104
    
104
105
 
105
106
    def _unpack_inventory(self, elt):
107
108
        """
108
109
        assert elt.tag == 'inventory'
109
110
        root_id = elt.get('file_id') or ROOT_ID
110
 
        format = elt.get('format')
111
 
        if format is not None:
112
 
            if format != '5':
113
 
                raise BzrError("invalid format version %r on inventory"
114
 
                                % format)
115
111
        inv = Inventory(root_id)
116
112
        for e in elt:
117
113
            ie = self._unpack_entry(e)
158
154
    def _unpack_revision(self, elt):
159
155
        """XML Element -> Revision object"""
160
156
        assert elt.tag == 'revision'
161
 
        format = elt.get('format')
162
 
        if format is not None:
163
 
            if format != '5':
164
 
                raise BzrError("invalid format version %r on inventory"
165
 
                                % format)
 
157
        
166
158
        rev = Revision(committer = elt.get('committer'),
167
159
                       timestamp = float(elt.get('timestamp')),
168
160
                       revision_id = elt.get('revision_id'),
169
161
                       inventory_sha1 = elt.get('inventory_sha1')
170
162
                       )
 
163
 
171
164
        parents = elt.find('parents') or []
172
165
        for p in parents:
173
166
            assert p.tag == 'revision_ref', \
181
174
        return rev
182
175
 
183
176
 
 
177
 
184
178
serializer_v5 = Serializer_v5()