~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_versionedfile.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
841
841
class TestPlanMergeVersionedFile(TestCaseWithMemoryTransport):
842
842
 
843
843
    def setUp(self):
844
 
        TestCaseWithMemoryTransport.setUp(self)
 
844
        super(TestPlanMergeVersionedFile, self).setUp()
845
845
        mapper = PrefixMapper()
846
846
        factory = make_file_factory(True, mapper)
847
847
        self.vf1 = factory(self.get_transport('root-1'))
904
904
        # we should be able to read from http with a versioned file.
905
905
        vf = self.get_file()
906
906
        # try an empty file access
907
 
        readonly_vf = self.get_factory()('foo', transport.get_transport(
908
 
                self.get_readonly_url('.')))
 
907
        readonly_vf = self.get_factory()('foo',
 
908
            transport.get_transport_from_url(self.get_readonly_url('.')))
909
909
        self.assertEqual([], readonly_vf.versions())
910
910
 
911
911
    def test_readonly_http_works_with_feeling(self):
914
914
        # now with feeling.
915
915
        vf.add_lines('1', [], ['a\n'])
916
916
        vf.add_lines('2', ['1'], ['b\n', 'a\n'])
917
 
        readonly_vf = self.get_factory()('foo', transport.get_transport(
918
 
                self.get_readonly_url('.')))
 
917
        readonly_vf = self.get_factory()('foo',
 
918
            transport.get_transport_from_url(self.get_readonly_url('.')))
919
919
        self.assertEqual(['1', '2'], vf.versions())
920
920
        self.assertEqual(['1', '2'], readonly_vf.versions())
921
921
        for version in readonly_vf.versions():
1482
1482
        else:
1483
1483
            return ('FileA',) + (suffix,)
1484
1484
 
 
1485
    def test_add_fallback_implies_without_fallbacks(self):
 
1486
        f = self.get_versionedfiles('files')
 
1487
        if getattr(f, 'add_fallback_versioned_files', None) is None:
 
1488
            raise TestNotApplicable("%s doesn't support fallbacks"
 
1489
                                    % (f.__class__.__name__,))
 
1490
        g = self.get_versionedfiles('fallback')
 
1491
        key_a = self.get_simple_key('a')
 
1492
        g.add_lines(key_a, [], ['\n'])
 
1493
        f.add_fallback_versioned_files(g)
 
1494
        self.assertTrue(key_a in f.get_parent_map([key_a]))
 
1495
        self.assertFalse(key_a in f.without_fallbacks().get_parent_map([key_a]))
 
1496
 
1485
1497
    def test_add_lines(self):
1486
1498
        f = self.get_versionedfiles()
1487
1499
        key0 = self.get_simple_key('r0')
2734
2746
        return ret
2735
2747
 
2736
2748
    def setUp(self):
2737
 
        TestCase.setUp(self)
 
2749
        super(VirtualVersionedFilesTests, self).setUp()
2738
2750
        self._lines = {}
2739
2751
        self._parent_map = {}
2740
2752
        self.texts = VirtualVersionedFiles(self._get_parent_map,