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

  • Committer: John Arbash Meinel
  • Date: 2009-05-11 18:59:15 UTC
  • mto: This revision was merged to the branch mainline in revision 4392.
  • Revision ID: john@arbash-meinel.com-20090511185915-syglc7tz3vsprwpu
Some cleanup passes.

move test_resume_chk_bytes from per_repository_referece to test_pack_repository,
as it is a bit more implementation specific.
Make sure we don't allow get_stream_for_missing_keys() if we have a pending stream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1666
1666
 
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,
 
1676
        #       first.
1679
1677
        if not self._parents:
1680
1678
            # No parents to be missing
1681
 
            return missing_parents
 
1679
            return set()
 
1680
        parents = set()
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)
1695
1692
 
1696
1693
    def get_build_details(self, keys):
1697
1694
        """Get the various build details for keys.
1753
1750
 
1754
1751
        :param graph_index: A GraphIndex
1755
1752
        """
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
 
1756
        # caching the info.
1762
1757
 
1763
1758
 
1764
1759