~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml.py

  • Committer: Aaron Bentley
  • Date: 2005-10-03 16:53:39 UTC
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: abentley@panoramicfeedback.com-20051003165339-9ee4d484477fd164
Ignored user-installed plugins

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    from cElementTree import (ElementTree, SubElement, Element,
29
29
                              XMLTreeBuilder, fromstring, tostring)
30
30
except ImportError:
31
 
    mutter('WARNING: using slower ElementTree; consider installing cElementTree'
32
 
           " and make sure it's on your PYTHONPATH")
 
31
    ## from warnings import warn
 
32
    ## warn('using slower ElementTree; consider installing cElementTree')
33
33
    from util.elementtree.ElementTree import (ElementTree, SubElement,
34
34
                                              Element, XMLTreeBuilder,
35
35
                                              fromstring, tostring)
36
36
 
 
37
from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
37
38
from bzrlib.errors import BzrError
38
39
 
39
40
 
45
46
        self._write_element(elt, f)
46
47
 
47
48
    def write_inventory_to_string(self, inv):
48
 
        return tostring(self._pack_inventory(inv)) + '\n'
 
49
        return tostring(self._pack_inventory(inv))
49
50
 
50
51
    def read_inventory_from_string(self, xml_string):
51
52
        return self._unpack_inventory(fromstring(xml_string))
57
58
        self._write_element(self._pack_revision(rev), f)
58
59
 
59
60
    def write_revision_to_string(self, rev):
60
 
        return tostring(self._pack_revision(rev)) + '\n'
 
61
        return tostring(self._pack_revision(rev), f)
61
62
 
62
63
    def read_revision(self, f):
63
64
        return self._unpack_revision(self._read_element(f))
71
72
 
72
73
    def _read_element(self, f):
73
74
        return ElementTree().parse(f)
 
75