~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Andrew Bennetts
  • Date: 2009-07-07 07:49:28 UTC
  • mto: (4476.3.44 inventory-delta)
  • mto: This revision was merged to the branch mainline in revision 4608.
  • Revision ID: andrew.bennetts@canonical.com-20090707074928-miuk8x4gzvr6ihly
All fetch and interrepo tests passing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4176
4176
                # No need to stream something we don't have
4177
4177
                continue
4178
4178
            if substream_kind == 'inventories':
 
4179
                # Some missing keys are genuinely ghosts, filter those out.
 
4180
                present = self.from_repository.inventories.get_parent_map(keys)
 
4181
                revs = [key[0] for key in present]
4179
4182
                # As with the original stream, we may need to generate root
4180
4183
                # texts for the inventories we're about to stream.
4181
 
                revs = [key[0] for key in keys]
4182
4184
                for _ in self._generate_root_texts(revs):
4183
4185
                    yield _
4184
4186
                # Get the inventory stream more-or-less as we do for the
4210
4212
            self.to_format.rich_root_data)
4211
4213
 
4212
4214
    def _get_inventory_stream(self, revision_ids, missing=False):
4213
 
        # XXX: should all three cases take 'missing' into account?
4214
4215
        from_format = self.from_repository._format
4215
4216
        if (from_format.supports_chks and self.to_format.supports_chks
4216
4217
            and (from_format._serializer == self.to_format._serializer)):
4217
4218
            # Both sides support chks, and they use the same serializer, so it
4218
4219
            # is safe to transmit the chk pages and inventory pages across
4219
4220
            # as-is.
 
4221
            # XXX: does this case need to take 'missing' into account?
4220
4222
            return self._get_chk_inventory_stream(revision_ids)
4221
4223
        elif (not from_format.supports_chks):
4222
4224
            # Source repository doesn't support chks. So we can transmit the
4223
4225
            # inventories 'as-is' and either they are just accepted on the
4224
4226
            # target, or the Sink will properly convert it.
4225
 
            return self._get_simple_inventory_stream(revision_ids)
 
4227
            return self._get_simple_inventory_stream(revision_ids,
 
4228
                    missing=missing)
4226
4229
        else:
4227
4230
            # XXX: xxx
4228
4231
            # XXX: Hack to make not-chk->chk fetch: copy the inventories as
4234
4237
            return self._get_convertable_inventory_stream(revision_ids,
4235
4238
                    fulltexts=missing)
4236
4239
 
4237
 
    def _get_simple_inventory_stream(self, revision_ids):
 
4240
    def _get_simple_inventory_stream(self, revision_ids, missing=False):
4238
4241
        # NB: This currently reopens the inventory weave in source;
4239
4242
        # using a single stream interface instead would avoid this.
4240
4243
        from_weave = self.from_repository.inventories
 
4244
        if missing:
 
4245
            delta_closure = True
 
4246
        else:
 
4247
            delta_closure = not self.delta_on_metadata()
4241
4248
        yield ('inventories', from_weave.get_record_stream(
4242
4249
            [(rev_id,) for rev_id in revision_ids],
4243
 
            self.inventory_fetch_order(),
4244
 
            not self.delta_on_metadata()))
 
4250
            self.inventory_fetch_order(), delta_closure))
4245
4251
 
4246
4252
    def _get_chk_inventory_stream(self, revision_ids):
4247
4253
        """Fetch the inventory texts, along with the associated chk maps."""