/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_versionedfile.py

[merge] bzr.dev 2255, resolve conflicts, update copyrights

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
#
3
3
# Authors:
4
4
#   Johan Rydberg <jrydberg@gnu.org>
140
140
        except NotImplementedError:
141
141
            pass
142
142
 
 
143
    def test_add_reserved(self):
 
144
        vf = self.get_file()
 
145
        self.assertRaises(errors.ReservedId,
 
146
            vf.add_lines, 'a:', [], ['a\n', 'b\n', 'c\n'])
 
147
 
 
148
        self.assertRaises(errors.ReservedId,
 
149
            vf.add_delta, 'a:', [], None, 'sha1', False, ((0, 0, 0, []),))
 
150
 
 
151
    def test_get_reserved(self):
 
152
        vf = self.get_file()
 
153
        self.assertRaises(errors.ReservedId, vf.get_delta, 'b:')
 
154
        self.assertRaises(errors.ReservedId, vf.get_texts, ['b:'])
 
155
        self.assertRaises(errors.ReservedId, vf.get_lines, 'b:')
 
156
        self.assertRaises(errors.ReservedId, vf.get_text, 'b:')
 
157
 
143
158
    def test_get_delta(self):
144
159
        f = self.get_file()
145
160
        sha1s = self._setup_for_deltas(f)
586
601
            if []!= progress.updates: 
587
602
                self.assertEqual(expected, progress.updates)
588
603
            return lines
589
 
        lines = iter_with_versions(['child', 'otherchild'], 
590
 
                                   [('Walking content.', 0, 2), 
591
 
                                    ('Walking content.', 0, 2), 
592
 
                                    ('Walking content.', 3, 2), 
 
604
        lines = iter_with_versions(['child', 'otherchild'],
 
605
                                   [('Walking content.', 0, 2),
 
606
                                    ('Walking content.', 1, 2),
593
607
                                    ('Walking content.', 2, 2)])
594
608
        # we must see child and otherchild
595
609
        self.assertTrue(lines['child\n'] > 0)
597
611
        # we dont care if we got more than that.
598
612
        
599
613
        # test all lines
600
 
        lines = iter_with_versions(None, [('Walking content.', 0, 5), 
601
 
                                          ('Walking content.', 0, 5), 
602
 
                                          ('Walking content.', 1, 5), 
603
 
                                          ('Walking content.', 2, 5), 
604
 
                                          ('Walking content.', 2, 5), 
605
 
                                          ('Walking content.', 3, 5), 
 
614
        lines = iter_with_versions(None, [('Walking content.', 0, 5),
 
615
                                          ('Walking content.', 1, 5),
 
616
                                          ('Walking content.', 2, 5),
 
617
                                          ('Walking content.', 3, 5),
 
618
                                          ('Walking content.', 4, 5),
606
619
                                          ('Walking content.', 5, 5)])
607
620
        # all lines must be seen at least once
608
621
        self.assertTrue(lines['base\n'] > 0)
664
677
            self.assertRaises(NotImplementedError, vf.get_parents_with_ghosts, 'foo')
665
678
            self.assertRaises(NotImplementedError, vf.get_graph_with_ghosts)
666
679
            return
 
680
        vf = self.reopen_file()
667
681
        # test key graph related apis: getncestry, _graph, get_parents
668
682
        # has_version
669
683
        # - these are ghost unaware and must not be reflect ghosts