~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_knit.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:
1637
1637
              ([('missing-parent', ), ('ghost', )], [('missing-parent', )]))])
1638
1638
        return graph_index
1639
1639
 
 
1640
    def make_g_index_missing_parent(self):
 
1641
        graph_index = self.make_g_index('missing_parent', 2,
 
1642
            [(('parent', ), ' 100 78', ([], [])),
 
1643
             (('tip', ), ' 100 78',
 
1644
              ([('parent', ), ('missing-parent', )], [('parent', )])),
 
1645
              ])
 
1646
        return graph_index
 
1647
 
1640
1648
    def make_g_index_no_external_refs(self):
1641
1649
        graph_index = self.make_g_index('no_external_refs', 2,
1642
1650
            [(('rev', ), ' 100 78',
1650
1658
        index.scan_unvalidated_index(unvalidated)
1651
1659
        self.assertEqual(frozenset(), index.get_missing_compression_parents())
1652
1660
 
1653
 
    def test_add_incomplete_unvalidated_index(self):
 
1661
    def test_add_missing_compression_parent_unvalidated_index(self):
1654
1662
        unvalidated = self.make_g_index_missing_compression_parent()
1655
1663
        combined = CombinedGraphIndex([unvalidated])
1656
1664
        index = _KnitGraphIndex(combined, lambda: True, deltas=True)
1662
1670
            frozenset([('missing-parent',)]),
1663
1671
            index.get_missing_compression_parents())
1664
1672
 
 
1673
    def test_add_missing_noncompression_parent_unvalidated_index(self):
 
1674
        unvalidated = self.make_g_index_missing_parent()
 
1675
        combined = CombinedGraphIndex([unvalidated])
 
1676
        index = _KnitGraphIndex(combined, lambda: True, deltas=True,
 
1677
            track_external_parent_refs=True)
 
1678
        index.scan_unvalidated_index(unvalidated)
 
1679
        self.assertEqual(
 
1680
            frozenset([('missing-parent',)]), index.get_missing_parents())
 
1681
 
 
1682
    def test_track_external_parent_refs(self):
 
1683
        g_index = self.make_g_index('empty', 2, [])
 
1684
        combined = CombinedGraphIndex([g_index])
 
1685
        index = _KnitGraphIndex(combined, lambda: True, deltas=True,
 
1686
            add_callback=self.catch_add, track_external_parent_refs=True)
 
1687
        self.caught_entries = []
 
1688
        index.add_records([
 
1689
            (('new-key',), 'fulltext,no-eol', (None, 50, 60),
 
1690
             [('parent-1',), ('parent-2',)])])
 
1691
        self.assertEqual(
 
1692
            frozenset([('parent-1',), ('parent-2',)]),
 
1693
            index.get_missing_parents())
 
1694
 
1665
1695
    def test_add_unvalidated_index_with_present_external_references(self):
1666
1696
        index = self.two_graph_index(deltas=True)
1667
1697
        # Ugly hack to get at one of the underlying GraphIndex objects that