1667
1667
def get_missing_parents(self):
1668
1668
# This is called by
1669
# repository.StreamSink.get_missing_parent_inventories
1670
# This is the knit.py implementation, which seems to have a flag at
1671
# *creation* to track things that are missing...
1672
## def get_missing_parents(self):
1673
## """Return the keys of missing parents."""
1674
## # We may have false positives, so filter those out.
1675
## self._external_parent_refs.difference_update(
1676
## self.get_parent_map(self._external_parent_refs))
1677
## return frozenset(self._external_parent_refs)
1678
missing_parents = set()
1669
# repository.StreamSink.get_missing_parent_inventories, and is only
1670
# called for the Repository.revisions versioned file.
1671
# TODO: This re-computes the full set of missing parents by walking all
1672
# entries. The code for knitpack formats tracks the inserts and
1673
# keeps a set of possible missing parents. We could probably do
1674
# this in a similar way. Though stacking implies not having many
1675
# revisions versus the base, so see what the actual cost is,
1679
1677
if not self._parents:
1680
1678
# No parents to be missing
1681
return missing_parents
1682
1681
present_keys = set()
1683
1682
for _, key, _, ref_lists in self._graph_index.iter_all_entries():
1684
missing_parents.update(ref_lists[0])
1683
parents.update(ref_lists[0])
1685
1684
present_keys.add(key)
1686
# XXX: This function is *not* exercised very thoroughly in the test
1687
# suite. At least not by per_repository_reference tests. (Which
1688
# are all the repos that support stacking...)
1689
# Tracing here, I have many tests that have 0 entries for both,
1690
# and I haven't found *any* that have parent_entries, much less a
1691
# genuine missing parent entry.
1692
# if missing_parents or present_keys:
1693
# import pdb; pdb.set_trace()
1694
return missing_parents.difference(present_keys)
1685
# TODO: This function is *not* exercised very thoroughly in the test
1686
# suite. At least not by per_repository_reference tests. (Which
1687
# are all the repos that support stacking...) Tracing here, I
1688
# have many tests that have 0 entries for both, and I haven't
1689
# found *any* that have parent_entries, much less a genuine
1690
# missing parent entry.
1691
return parents.difference(present_keys)
1696
1693
def get_build_details(self, keys):
1697
1694
"""Get the various build details for keys.
1754
1751
:param graph_index: A GraphIndex
1756
if False and self._external_parent_refs is not None:
1757
# Add parent refs from graph_index (and discard parent refs that
1758
# the graph_index has).
1759
for node in graph_index.iter_all_entries():
1760
self._external_parent_refs.update(node[3][0])
1761
self._external_parent_refs.discard(node[1])
1753
# We currently don't cache anything about external references, etc.
1754
# We don't have 'missing_compression_parents' to care about, and we
1755
# currently compute 'missing_parents' when requested, rather than