/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/repository.py

  • Committer: Robert J. Tanner
  • Date: 2009-04-29 05:53:21 UTC
  • mfrom: (4311 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4312.
  • Revision ID: tanner@real-time.com-20090429055321-v2s5l1mgki9f6cgn
[merge] 1.14 back to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1424
1424
    def suspend_write_group(self):
1425
1425
        raise errors.UnsuspendableWriteGroup(self)
1426
1426
 
 
1427
    def get_missing_parent_inventories(self):
 
1428
        """Return the keys of missing inventory parents for revisions added in
 
1429
        this write group.
 
1430
 
 
1431
        A revision is not complete if the inventory delta for that revision
 
1432
        cannot be calculated.  Therefore if the parent inventories of a
 
1433
        revision are not present, the revision is incomplete, and e.g. cannot
 
1434
        be streamed by a smart server.  This method finds missing inventory
 
1435
        parents for revisions added in this write group.
 
1436
        """
 
1437
        if not self._format.supports_external_lookups:
 
1438
            # This is only an issue for stacked repositories
 
1439
            return set()
 
1440
        if not self.is_in_write_group():
 
1441
            raise AssertionError('not in a write group')
 
1442
                
 
1443
        # XXX: We assume that every added revision already has its
 
1444
        # corresponding inventory, so we only check for parent inventories that
 
1445
        # might be missing, rather than all inventories.
 
1446
        parents = set(self.revisions._index.get_missing_parents())
 
1447
        parents.discard(_mod_revision.NULL_REVISION)
 
1448
        unstacked_inventories = self.inventories._index
 
1449
        present_inventories = unstacked_inventories.get_parent_map(
 
1450
            key[-1:] for key in parents)
 
1451
        parents.difference_update(present_inventories)
 
1452
        missing_keys = set(('inventories', rev_id) for (rev_id,) in parents)
 
1453
        return missing_keys
 
1454
 
1427
1455
    def refresh_data(self):
1428
1456
        """Re-read any data needed to to synchronise with disk.
1429
1457
 
3998
4026
                self.target_repo.signatures.insert_record_stream(substream)
3999
4027
            else:
4000
4028
                raise AssertionError('kaboom! %s' % (substream_type,))
 
4029
        # Find all the new revisions (including ones from resume_tokens)
 
4030
        missing_keys = self.target_repo.get_missing_parent_inventories()
4001
4031
        try:
4002
 
            missing_keys = set()
4003
4032
            for prefix, versioned_file in (
4004
4033
                ('texts', self.target_repo.texts),
4005
4034
                ('inventories', self.target_repo.inventories),