/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

Update with new parent-ids patch.

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
 
from bzrlib.branch import Branch
23
 
from bzrlib.revision import Revision
24
23
from bzrlib.uncommit import uncommit
25
 
import bzrlib.xml5
26
24
 
27
25
 
28
26
class TestParents(TestCaseWithWorkingTree):
47
45
        t.set_parent_trees([])
48
46
        self.assertConsistentParents([], t)
49
47
 
50
 
    def test_set_one_ghost_parent(self):
51
 
        t = self.make_branch_and_tree('.')
52
 
        t.set_parent_trees([('missing-revision-id', None)])
 
48
    def test_set_one_ghost_parent_rejects(self):
 
49
        t = self.make_branch_and_tree('.')
 
50
        self.assertRaises(errors.GhostRevision,
 
51
            t.set_parent_trees, [('missing-revision-id', None)])
 
52
 
 
53
    def test_set_one_ghost_parent_force(self):
 
54
        t = self.make_branch_and_tree('.')
 
55
        t.set_parent_trees([('missing-revision-id', None)],
 
56
            allow_leftmost_as_ghost=True)
53
57
        self.assertConsistentParents(['missing-revision-id'], t)
54
58
 
55
59
    def test_set_two_parents_one_ghost(self):
88
92
        t.set_parent_ids([])
89
93
        self.assertConsistentParents([], t)
90
94
 
91
 
    def test_set_one_ghost_parent_ids(self):
92
 
        t = self.make_branch_and_tree('.')
93
 
        t.set_parent_ids(['missing-revision-id'])
 
95
    def test_set_one_ghost_parent_ids_rejects(self):
 
96
        t = self.make_branch_and_tree('.')
 
97
        self.assertRaises(errors.GhostRevision,
 
98
            t.set_parent_ids, ['missing-revision-id'])
 
99
 
 
100
    def test_set_one_ghost_parent_ids_force(self):
 
101
        t = self.make_branch_and_tree('.')
 
102
        t.set_parent_ids(['missing-revision-id'],
 
103
            allow_leftmost_as_ghost=True)
94
104
        self.assertConsistentParents(['missing-revision-id'], t)
95
105
 
96
106
    def test_set_two_parents_one_ghost_ids(self):
128
138
        tree.add_parent_tree_id(first_revision)
129
139
        self.assertConsistentParents([first_revision], tree)
130
140
        
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')
 
141
    def test_add_first_parent_id_ghost_rejects(self):
 
142
        """Test adding the first parent id - as a ghost"""
 
143
        tree = self.make_branch_and_tree('.')
 
144
        self.assertRaises(errors.GhostRevision,
 
145
            tree.add_parent_tree_id, 'first-revision')
 
146
        
 
147
    def test_add_first_parent_id_ghost_force(self):
 
148
        """Test adding the first parent id - as a ghost"""
 
149
        tree = self.make_branch_and_tree('.')
 
150
        tree.add_parent_tree_id('first-revision', allow_leftmost_as_ghost=True)
135
151
        self.assertConsistentParents(['first-revision'], tree)
136
152
        
137
153
    def test_add_second_parent_id(self):
159
175
            tree.branch.repository.revision_tree(first_revision)))
160
176
        self.assertConsistentParents([first_revision], tree)
161
177
        
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))
 
178
    def test_add_first_parent_tree_ghost_rejects(self):
 
179
        """Test adding the first parent id - as a ghost"""
 
180
        tree = self.make_branch_and_tree('.')
 
181
        self.assertRaises(errors.GhostRevision,
 
182
            tree.add_parent_tree, ('first-revision', None))
 
183
        
 
184
    def test_add_first_parent_tree_ghost_force(self):
 
185
        """Test adding the first parent id - as a ghost"""
 
186
        tree = self.make_branch_and_tree('.')
 
187
        tree.add_parent_tree(('first-revision', None),
 
188
            allow_leftmost_as_ghost=True)
166
189
        self.assertConsistentParents(['first-revision'], tree)
167
190
        
168
191
    def test_add_second_parent_tree(self):