~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-06 22:59:58 UTC
  • mfrom: (1740.2.6 bzr.checkout)
  • Revision ID: pqm@pqm.ubuntu.com-20060606225958-17ab4431da6b44f6
Speed up checkout by using existing revision text when possible

Show diffs side-by-side

added added

removed removed

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