/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Aaron Bentley
  • Date: 2006-06-05 17:51:53 UTC
  • mto: This revision was merged to the branch mainline in revision 1745.
  • Revision ID: aaron.bentley@utoronto.ca-20060605175153-3a1af9d399f2ef5e
Only reserialize the working tree basis inventory when needed. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1188
1188
 
1189
1189
    def _cache_basis_inventory(self, new_revision):
1190
1190
        """Cache new_revision as the basis inventory."""
 
1191
        # TODO: this should allow the ready-to-use inventory to be passed in,
 
1192
        # as commit already has that ready-to-use [while the format is the
 
1193
        # same, that is].
1191
1194
        try:
1192
1195
            # this double handles the inventory - unpack and repack - 
1193
1196
            # but is easier to understand. We can/should put a conditional
1194
1197
            # in here based on whether the inventory is in the latest format
1195
1198
            # - perhaps we should repack all inventories on a repository
1196
1199
            # upgrade ?
1197
 
            inv = self.branch.repository.get_inventory(new_revision)
1198
 
            inv.revision_id = new_revision
1199
 
            xml = bzrlib.xml5.serializer_v5.write_inventory_to_string(inv)
 
1200
            # the fast path is to copy the raw xml from the repository. If the
 
1201
            # xml contains 'revision_id="', then we assume the right 
 
1202
            # revision_id is set. We must check for this full string, because a
 
1203
            # root node id can legitimately look like 'revision_id' but cannot
 
1204
            # contain a '"'.
 
1205
            xml = self.branch.repository.get_inventory_xml(new_revision)
 
1206
            if not 'revision_id="' in xml.split('\n', 1)[0]:
 
1207
                inv = self.branch.repository.deserialise_inventory(
 
1208
                    new_revision, xml)
 
1209
                inv.revision_id = new_revision
 
1210
                xml = bzrlib.xml5.serializer_v5.write_inventory_to_string(inv)
1200
1211
 
1201
1212
            path = self._basis_inventory_name()
1202
1213
            self._control_files.put_utf8(path, xml)