1
1
# (C) 2005 Canonical Ltd
 
3
3
# This program is free software; you can redistribute it and/or modify
 
4
4
# it under the terms of the GNU General Public License as published by
 
5
5
# the Free Software Foundation; either version 2 of the License, or
 
6
6
# (at your option) any later version.
 
8
8
# This program is distributed in the hope that it will be useful,
 
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
11
# GNU General Public License for more details.
 
13
13
# You should have received a copy of the GNU General Public License
 
14
14
# along with this program; if not, write to the Free Software
 
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 
from bzrlib.xml import ElementTree, Element
 
 
17
from xml import ElementTree, Element
 
20
20
def write_inventory(inv, f):
 
21
21
    el = Element('inventory', {'version': '2'})
 
24
24
    root = Element('root_directory', {'id': inv.root.file_id})
 
25
25
    root.tail = root.text = '\n'
 
 
35
35
                el.set('text_id', ie.text_id)
 
37
37
                el.set('text_sha1', ie.text_sha1)
 
38
 
            if ie.text_size is not None:
 
 
38
            if ie.text_size != None:
 
39
39
                el.set('text_size', ('%d' % ie.text_size))
 
40
40
        elif kind != 'directory':
 
41
41
            raise BzrError('unknown InventoryEntry kind %r' % kind)
 
 
84
84
                f.write('text_id="%s" ' % ie.text_id)
 
86
86
                f.write('text_sha1="%s" ' % ie.text_sha1)
 
87
 
            if ie.text_size is not None:
 
 
87
            if ie.text_size != None:
 
88
88
                f.write('text_size="%d" ' % ie.text_size)
 
90
90
        elif kind == 'directory':