~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml6.py

  • Committer: Robert Collins
  • Date: 2007-05-07 16:48:14 UTC
  • mto: This revision was merged to the branch mainline in revision 2485.
  • Revision ID: robertc@robertcollins.net-20070507164814-wpagonutf4b5cf8s
Move HACKING to docs/developers/HACKING and adjust Makefile to accomodate this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
2
2
#
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
19
19
 
20
20
class Serializer_v6(xml5.Serializer_v5):
21
21
 
 
22
    format_num = '6'
 
23
 
22
24
    def _append_inventory_root(self, append, inv):
23
25
        """Append the inventory root to output."""
24
26
        append('<inventory')
25
 
        append(' format="6"')
 
27
        append(' format="%s"' % self.format_num)
26
28
        if inv.revision_id is not None:
27
29
            append(' revision_id="')
28
30
            append(xml5._encode_and_escape(inv.revision_id))
37
39
        if elt.tag != 'inventory':
38
40
            raise errors.UnexpectedInventoryFormat('Root tag is %r' % elt.tag)
39
41
        format = elt.get('format')
40
 
        if format != '6':
 
42
        if format != self.format_num:
41
43
            raise errors.UnexpectedInventoryFormat('Invalid format version %r'
42
44
                                                   % format)
43
45
        revision_id = elt.get('revision_id')
44
46
        if revision_id is not None:
45
 
            revision_id = cache_utf8.get_cached_unicode(revision_id)
 
47
            revision_id = cache_utf8.encode(revision_id)
46
48
        inv = inventory.Inventory(root_id=None, revision_id=revision_id)
47
49
        for e in elt:
48
 
            ie = self._unpack_entry(e, none_parents=True)
 
50
            ie = self._unpack_entry(e)
49
51
            inv.add(ie)
50
52
        return inv
51
53