~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_knit.py

define behaviour for add_lines with stacked storage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1395
1395
        test.add_fallback_versioned_files(basis)
1396
1396
 
1397
1397
    def test_add_lines(self):
1398
 
        pass
 
1398
        # lines added to the test are not added to the basis
 
1399
        basis, test = self.get_basis_and_test_knit()
 
1400
        key = ('foo',)
 
1401
        key_basis = ('bar',)
 
1402
        key_cross_border = ('quux',)
 
1403
        key_delta = ('zaphod',)
 
1404
        test.add_lines(key, (), ['foo\n'])
 
1405
        self.assertEqual({}, basis.get_parent_map([key]))
 
1406
        # lines added to the test that reference across the stack do a
 
1407
        # fulltext.
 
1408
        basis.add_lines(key_basis, (), ['foo\n'])
 
1409
        basis.calls = []
 
1410
        test.add_lines(key_cross_border, (key_basis,), ['foo\n'])
 
1411
        self.assertEqual('fulltext', test._index.get_method(key_cross_border))
 
1412
        self.assertEqual([("get_parent_map", set([key_basis]))], basis.calls)
 
1413
        basis.calls = []
 
1414
        # Subsequent adds do delta.
 
1415
        test.add_lines(key_delta, (key_cross_border,), ['foo\n'])
 
1416
        self.assertEqual('line-delta', test._index.get_method(key_delta))
 
1417
        self.assertEqual([], basis.calls)
1399
1418
 
1400
1419
    def test_annotate(self):
1401
1420
        # annotations from the test knit are answered without asking the basis