1424
1424
def suspend_write_group(self):
1425
1425
raise errors.UnsuspendableWriteGroup(self)
1427
def get_missing_parent_inventories(self):
1428
"""Return the keys of missing inventory parents for revisions added in
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.
1437
if not self._format.supports_external_lookups:
1438
# This is only an issue for stacked repositories
1440
if not self.is_in_write_group():
1441
raise AssertionError('not in a write group')
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)
1427
1455
def refresh_data(self):
1428
1456
"""Re-read any data needed to to synchronise with disk.
3998
4026
self.target_repo.signatures.insert_record_stream(substream)
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()
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),