1
# Copyright (C) 2005, 2006 Canonical Ltd
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
6
4
# (at your option) any later version.
8
6
# This program is distributed in the hope that it will be useful,
9
7
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
9
# GNU General Public License for more details.
13
11
# You should have received a copy of the GNU General Public License
14
12
# along with this program; if not, write to the Free Software
15
13
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
from bzrlib.xml_serializer import ElementTree, SubElement, Element, Serializer
16
from bzrlib.xml import ElementTree, SubElement, Element, Serializer
18
17
from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
19
18
import bzrlib.inventory as inventory
20
19
from bzrlib.revision import Revision
21
20
from bzrlib.errors import BzrError
24
27
class _Serializer_v4(Serializer):
25
28
"""Version 0.0.4 serializer
27
You should use the serializer_v4 singleton."""
30
You should use the serialzer_v4 singleton."""
31
34
def _pack_inventory(self, inv):
32
35
"""Convert to XML Element"""
33
# v4 serialization is not used any more.
34
raise NotImplementedError(self._pack_inventory)
35
36
e = Element('inventory')
37
38
if inv.root.file_id not in (None, ROOT_ID):
48
49
e.set('file_id', ie.file_id)
49
50
e.set('kind', ie.kind)
51
if ie.text_size is not None:
52
if ie.text_size != None:
52
53
e.set('text_size', '%d' % ie.text_size)
54
55
for f in ['text_id', 'text_sha1', 'symlink_target']:
59
60
# to be conservative, we don't externalize the root pointers