~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml4.py

  • Committer: Aaron Bentley
  • Date: 2005-10-01 06:48:01 UTC
  • mto: (1185.12.13)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: aaron.bentley@utoronto.ca-20051001064801-7400c2ed0fe26080
Made iter_conflicts a WorkingTree method

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from bzrlib.xml import ElementTree, SubElement, Element, Serializer
19
19
from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
20
 
import bzrlib.inventory as inventory
21
20
from bzrlib.revision import Revision        
22
21
from bzrlib.errors import BzrError
23
22
 
54
53
        if ie.text_size != None:
55
54
            e.set('text_size', '%d' % ie.text_size)
56
55
 
57
 
        for f in ['text_id', 'text_sha1', 'symlink_target']:
 
56
        for f in ['text_id', 'text_sha1']:
58
57
            v = getattr(ie, f)
59
58
            if v != None:
60
59
                e.set(f, v)
95
94
        if parent_id == None:
96
95
            parent_id = ROOT_ID
97
96
 
98
 
        kind = elt.get('kind')
99
 
        if kind == 'directory':
100
 
            ie = inventory.InventoryDirectory(elt.get('file_id'),
101
 
                                              elt.get('name'),
102
 
                                              parent_id)
103
 
        elif kind == 'file':
104
 
            ie = inventory.InventoryFile(elt.get('file_id'),
105
 
                                         elt.get('name'),
106
 
                                         parent_id)
107
 
            ie.text_id = elt.get('text_id')
108
 
            ie.text_sha1 = elt.get('text_sha1')
109
 
            v = elt.get('text_size')
110
 
            ie.text_size = v and int(v)
111
 
        elif kind == 'symlink':
112
 
            ie = inventory.InventoryLink(elt.get('file_id'),
113
 
                                         elt.get('name'),
114
 
                                         parent_id)
115
 
            ie.symlink_target = elt.get('symlink_target')
116
 
        else:
117
 
            raise BzrError("unknown kind %r" % kind)
 
97
        ie = InventoryEntry(elt.get('file_id'),
 
98
                            elt.get('name'),
 
99
                            elt.get('kind'),
 
100
                            parent_id)
 
101
        ie.text_id = elt.get('text_id')
 
102
        ie.text_sha1 = elt.get('text_sha1')
118
103
 
119
104
        ## mutter("read inventoryentry: %r" % (elt.attrib))
120
105
 
 
106
        v = elt.get('text_size')
 
107
        ie.text_size = v and int(v)
 
108
 
121
109
        return ie
122
110
 
123
111