~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_knit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-03-28 06:42:20 UTC
  • mfrom: (3287.6.9 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080328064220-ongijg78bfqhvbay
Deprecate a number of VersionedFile method calls,
        and Repository.get_revision_graph. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
628
628
            {}),
629
629
            transport.calls.pop(0))
630
630
 
631
 
    def test_get_graph(self):
632
 
        transport = MockTransport()
633
 
        index = self.get_knit_index(transport, "filename", "w", create=True)
634
 
        self.assertEqual([], index.get_graph())
635
 
 
636
 
        index.add_version("a", ["option"], (None, 0, 1), ["b"])
637
 
        self.assertEqual([("a", ("b",))], index.get_graph())
638
 
 
639
 
        index.add_version("c", ["option"], (None, 0, 1), ["d"])
640
 
        self.assertEqual([("a", ("b",)), ("c", ("d",))],
641
 
            sorted(index.get_graph()))
642
 
 
643
631
    def test_get_ancestry(self):
644
632
        transport = MockTransport([
645
633
            _KnitIndex.HEADER,
1897
1885
        # The target knit object is in a consistent state, i.e. the record we
1898
1886
        # just added is immediately visible.
1899
1887
        self.assertTrue(target.has_version('text-a'))
1900
 
        self.assertTrue(target.has_ghost('text-ghost'))
 
1888
        self.assertFalse(target.has_version('text-ghost'))
 
1889
        self.assertEqual({'text-a':('text-ghost',)},
 
1890
            target.get_parent_map(['text-a', 'text-ghost']))
1901
1891
        self.assertEqual(split_lines(TEXT_1), target.get_lines('text-a'))
1902
1892
 
1903
1893
    def test_insert_data_stream_inconsistent_version_lines(self):
2289
2279
        return KnitGraphIndex(combined_index, deltas=deltas,
2290
2280
            add_callback=add_callback)
2291
2281
 
2292
 
    def test_get_graph(self):
2293
 
        index = self.two_graph_index()
2294
 
        self.assertEqual(set([
2295
 
            ('tip', ('parent', )),
2296
 
            ('tail', ()),
2297
 
            ('parent', ('tail', 'ghost')),
2298
 
            ('separate', ()),
2299
 
            ]), set(index.get_graph()))
2300
 
 
2301
2282
    def test_get_ancestry(self):
2302
2283
        # get_ancestry is defined as eliding ghosts, not erroring.
2303
2284
        index = self.two_graph_index()
2587
2568
        return KnitGraphIndex(combined_index, parents=False,
2588
2569
            add_callback=add_callback)
2589
2570
 
2590
 
    def test_get_graph(self):
2591
 
        index = self.two_graph_index()
2592
 
        self.assertEqual(set([
2593
 
            ('tip', ()),
2594
 
            ('tail', ()),
2595
 
            ('parent', ()),
2596
 
            ('separate', ()),
2597
 
            ]), set(index.get_graph()))
2598
 
 
2599
2571
    def test_get_ancestry(self):
2600
2572
        # with no parents, ancestry is always just the key.
2601
2573
        index = self.two_graph_index()