/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/workingtree_implementations/test_parents.py

  • Committer: Robert Collins
  • Date: 2006-08-17 04:28:45 UTC
  • mto: (1908.6.5 use set_parent_trees.)
  • mto: This revision was merged to the branch mainline in revision 1972.
  • Revision ID: robertc@robertcollins.net-20060817042845-74baf6dc1e04b201
Add a guard against setting the tree last-revision value to a ghost in the new tree parent management api.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import os
20
20
 
 
21
from bzrlib import errors
21
22
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
22
23
from bzrlib.branch import Branch
23
24
from bzrlib.revision import Revision
47
48
        t.set_parent_trees([])
48
49
        self.assertConsistentParents([], t)
49
50
 
50
 
    def test_set_one_ghost_parent(self):
51
 
        t = self.make_branch_and_tree('.')
52
 
        t.set_parent_trees([('missing-revision-id', None)])
 
51
    def test_set_one_ghost_parent_rejects(self):
 
52
        t = self.make_branch_and_tree('.')
 
53
        self.assertRaises(errors.GhostRevision,
 
54
            t.set_parent_trees, [('missing-revision-id', None)])
 
55
 
 
56
    def test_set_one_ghost_parent_force(self):
 
57
        t = self.make_branch_and_tree('.')
 
58
        t.set_parent_trees([('missing-revision-id', None)],
 
59
            allow_leftmost_as_ghost=True)
53
60
        self.assertConsistentParents(['missing-revision-id'], t)
54
61
 
55
62
    def test_set_two_parents_one_ghost(self):
88
95
        t.set_parent_ids([])
89
96
        self.assertConsistentParents([], t)
90
97
 
91
 
    def test_set_one_ghost_parent_ids(self):
92
 
        t = self.make_branch_and_tree('.')
93
 
        t.set_parent_ids(['missing-revision-id'])
 
98
    def test_set_one_ghost_parent_ids_rejects(self):
 
99
        t = self.make_branch_and_tree('.')
 
100
        self.assertRaises(errors.GhostRevision,
 
101
            t.set_parent_ids, ['missing-revision-id'])
 
102
 
 
103
    def test_set_one_ghost_parent_ids_force(self):
 
104
        t = self.make_branch_and_tree('.')
 
105
        t.set_parent_ids(['missing-revision-id'],
 
106
            allow_leftmost_as_ghost=True)
94
107
        self.assertConsistentParents(['missing-revision-id'], t)
95
108
 
96
109
    def test_set_two_parents_one_ghost_ids(self):
128
141
        tree.add_parent_tree_id(first_revision)
129
142
        self.assertConsistentParents([first_revision], tree)
130
143
        
131
 
    def test_add_first_parent_id_ghost(self):
132
 
        """Test adding the first parent id - as a ghost"""
133
 
        tree = self.make_branch_and_tree('.')
134
 
        tree.add_parent_tree_id('first-revision')
 
144
    def test_add_first_parent_id_ghost_rejects(self):
 
145
        """Test adding the first parent id - as a ghost"""
 
146
        tree = self.make_branch_and_tree('.')
 
147
        self.assertRaises(errors.GhostRevision,
 
148
            tree.add_parent_tree_id, 'first-revision')
 
149
        
 
150
    def test_add_first_parent_id_ghost_force(self):
 
151
        """Test adding the first parent id - as a ghost"""
 
152
        tree = self.make_branch_and_tree('.')
 
153
        tree.add_parent_tree_id('first-revision', allow_leftmost_as_ghost=True)
135
154
        self.assertConsistentParents(['first-revision'], tree)
136
155
        
137
156
    def test_add_second_parent_id(self):
159
178
            tree.branch.repository.revision_tree(first_revision)))
160
179
        self.assertConsistentParents([first_revision], tree)
161
180
        
162
 
    def test_add_first_parent_tree_ghost(self):
163
 
        """Test adding the first parent id - as a ghost"""
164
 
        tree = self.make_branch_and_tree('.')
165
 
        tree.add_parent_tree(('first-revision', None))
 
181
    def test_add_first_parent_tree_ghost_rejects(self):
 
182
        """Test adding the first parent id - as a ghost"""
 
183
        tree = self.make_branch_and_tree('.')
 
184
        self.assertRaises(errors.GhostRevision,
 
185
            tree.add_parent_tree, ('first-revision', None))
 
186
        
 
187
    def test_add_first_parent_tree_ghost_force(self):
 
188
        """Test adding the first parent id - as a ghost"""
 
189
        tree = self.make_branch_and_tree('.')
 
190
        tree.add_parent_tree(('first-revision', None),
 
191
            allow_leftmost_as_ghost=True)
166
192
        self.assertConsistentParents(['first-revision'], tree)
167
193
        
168
194
    def test_add_second_parent_tree(self):