/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-09 11:23:39 UTC
  • mto: (1908.6.2 use set_parent_trees.)
  • mto: This revision was merged to the branch mainline in revision 1972.
  • Revision ID: robertc@robertcollins.net-20060809112339-2fb0af74cc1495b7
Add WorkingTree.set_parent_ids.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        self.assertConsistentParents(
80
80
            [first_revision, second_revision, third_revision], t)
81
81
 
 
82
    def test_set_no_parents_ids(self):
 
83
        t = self.make_branch_and_tree('.')
 
84
        t.set_parent_ids([])
 
85
        self.assertEqual([], t.get_parent_ids())
 
86
        # now give it a real parent, and then set it to no parents again.
 
87
        t.commit('first post')
 
88
        t.set_parent_ids([])
 
89
        self.assertConsistentParents([], t)
 
90
 
 
91
    def test_set_one_ghost_parent_ids(self):
 
92
        t = self.make_branch_and_tree('.')
 
93
        t.set_parent_ids(['missing-revision-id'])
 
94
        self.assertConsistentParents(['missing-revision-id'], t)
 
95
 
 
96
    def test_set_two_parents_one_ghost_ids(self):
 
97
        t = self.make_branch_and_tree('.')
 
98
        revision_in_repo = t.commit('first post')
 
99
        # remove the tree's history
 
100
        uncommit(t.branch, tree=t)
 
101
        rev_tree = t.branch.repository.revision_tree(revision_in_repo)
 
102
        t.set_parent_ids([revision_in_repo, 'another-missing'])
 
103
        self.assertConsistentParents([revision_in_repo, 'another-missing'], t)
 
104
 
 
105
    def test_set_three_parents_ids(self):
 
106
        t = self.make_branch_and_tree('.')
 
107
        first_revision = t.commit('first post')
 
108
        uncommit(t.branch, tree=t)
 
109
        second_revision = t.commit('second post')
 
110
        uncommit(t.branch, tree=t)
 
111
        third_revision = t.commit('third post')
 
112
        uncommit(t.branch, tree=t)
 
113
        rev_tree1 = t.branch.repository.revision_tree(first_revision)
 
114
        rev_tree2 = t.branch.repository.revision_tree(second_revision)
 
115
        rev_tree3 = t.branch.repository.revision_tree(third_revision)
 
116
        t.set_parent_ids([first_revision, second_revision, third_revision])
 
117
        self.assertConsistentParents(
 
118
            [first_revision, second_revision, third_revision], t)
 
119
 
82
120
 
83
121
class TestAddParentId(TestParents):
84
122