~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml6.py

  • Committer: John Arbash Meinel
  • Date: 2006-11-10 15:38:16 UTC
  • mto: This revision was merged to the branch mainline in revision 2129.
  • Revision ID: john@arbash-meinel.com-20061110153816-46acf76fc86a512b
use try/finally to clean up a nested progress bar during weave fetching

Show diffs side-by-side

added added

removed removed

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