/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/tests/test_knit.py

  • Committer: Jelmer Vernooij
  • Date: 2009-05-28 16:04:39 UTC
  • mfrom: (4387 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4405.
  • Revision ID: jelmer@samba.org-20090528160439-4z0xlrk5nejobm7q
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
368
368
        """
369
369
        tree = self.make_branch_and_memory_tree('tree')
370
370
        tree.lock_write()
371
 
        self.addCleanup(tree.branch.repository.unlock)
 
371
        self.addCleanup(tree.unlock)
372
372
        tree.add([''], ['root-id'])
373
373
        tree.commit('one', rev_id='rev-1')
374
374
        tree.commit('two', rev_id='rev-2')
385
385
        collection.reset()
386
386
        repo.refresh_data()
387
387
        vf = tree.branch.repository.revisions
388
 
        del tree
389
388
        # Set up a reload() function that switches to using the new pack file
390
389
        new_index = new_pack.revision_index
391
390
        access_tuple = new_pack.access_tuple()
1637
1636
              ([('missing-parent', ), ('ghost', )], [('missing-parent', )]))])
1638
1637
        return graph_index
1639
1638
 
 
1639
    def make_g_index_missing_parent(self):
 
1640
        graph_index = self.make_g_index('missing_parent', 2,
 
1641
            [(('parent', ), ' 100 78', ([], [])),
 
1642
             (('tip', ), ' 100 78',
 
1643
              ([('parent', ), ('missing-parent', )], [('parent', )])),
 
1644
              ])
 
1645
        return graph_index
 
1646
 
1640
1647
    def make_g_index_no_external_refs(self):
1641
1648
        graph_index = self.make_g_index('no_external_refs', 2,
1642
1649
            [(('rev', ), ' 100 78',
1650
1657
        index.scan_unvalidated_index(unvalidated)
1651
1658
        self.assertEqual(frozenset(), index.get_missing_compression_parents())
1652
1659
 
1653
 
    def test_add_incomplete_unvalidated_index(self):
 
1660
    def test_add_missing_compression_parent_unvalidated_index(self):
1654
1661
        unvalidated = self.make_g_index_missing_compression_parent()
1655
1662
        combined = CombinedGraphIndex([unvalidated])
1656
1663
        index = _KnitGraphIndex(combined, lambda: True, deltas=True)
1662
1669
            frozenset([('missing-parent',)]),
1663
1670
            index.get_missing_compression_parents())
1664
1671
 
 
1672
    def test_add_missing_noncompression_parent_unvalidated_index(self):
 
1673
        unvalidated = self.make_g_index_missing_parent()
 
1674
        combined = CombinedGraphIndex([unvalidated])
 
1675
        index = _KnitGraphIndex(combined, lambda: True, deltas=True,
 
1676
            track_external_parent_refs=True)
 
1677
        index.scan_unvalidated_index(unvalidated)
 
1678
        self.assertEqual(
 
1679
            frozenset([('missing-parent',)]), index.get_missing_parents())
 
1680
 
 
1681
    def test_track_external_parent_refs(self):
 
1682
        g_index = self.make_g_index('empty', 2, [])
 
1683
        combined = CombinedGraphIndex([g_index])
 
1684
        index = _KnitGraphIndex(combined, lambda: True, deltas=True,
 
1685
            add_callback=self.catch_add, track_external_parent_refs=True)
 
1686
        self.caught_entries = []
 
1687
        index.add_records([
 
1688
            (('new-key',), 'fulltext,no-eol', (None, 50, 60),
 
1689
             [('parent-1',), ('parent-2',)])])
 
1690
        self.assertEqual(
 
1691
            frozenset([('parent-1',), ('parent-2',)]),
 
1692
            index.get_missing_parents())
 
1693
 
1665
1694
    def test_add_unvalidated_index_with_present_external_references(self):
1666
1695
        index = self.two_graph_index(deltas=True)
1667
1696
        # Ugly hack to get at one of the underlying GraphIndex objects that