/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/blackbox/test_uncommit.py

Merge bzr.dev,

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
        self.assertContainsRe(out, 'second commit')
49
49
 
50
50
        # Nothing has changed
51
 
        self.assertEqual('a2', wt.last_revision())
 
51
        self.assertEqual(['a2'], wt.get_parent_ids())
52
52
 
53
53
        # Uncommit, don't prompt
54
54
        out, err = self.run_bzr('uncommit', '--force')
56
56
        self.assertContainsRe(out, 'second commit')
57
57
 
58
58
        # This should look like we are back in revno 1
59
 
        self.assertEqual('a1', wt.last_revision())
 
59
        self.assertEqual(['a1'], wt.get_parent_ids())
60
60
        out, err = self.run_bzr('status')
61
61
        self.assertEquals(out, 'modified:\n  a\n')
62
62
 
63
63
    def test_uncommit_checkout(self):
64
64
        wt = self.create_simple_tree()
65
 
 
66
 
        checkout_tree = wt.bzrdir.sprout('checkout').open_workingtree()
67
 
        checkout_tree.branch.bind(wt.branch)
68
 
 
69
 
        self.assertEqual('a2', checkout_tree.last_revision())
 
65
        checkout_tree = wt.branch.create_checkout('checkout')
 
66
 
 
67
        self.assertEqual(['a2'], checkout_tree.get_parent_ids())
70
68
 
71
69
        os.chdir('checkout')
72
70
        out, err = self.run_bzr('uncommit', '--dry-run', '--force')
74
72
        self.assertNotContainsRe(out, 'initial commit')
75
73
        self.assertContainsRe(out, 'second commit')
76
74
 
77
 
        self.assertEqual('a2', checkout_tree.last_revision())
 
75
        self.assertEqual(['a2'], checkout_tree.get_parent_ids())
78
76
 
79
77
        out, err = self.run_bzr('uncommit', '--force')
80
78
        self.assertNotContainsRe(out, 'initial commit')
82
80
 
83
81
        # uncommit in a checkout should uncommit the parent branch
84
82
        # (but doesn't effect the other working tree)
85
 
        self.assertEquals('a1', checkout_tree.last_revision())
 
83
        self.assertEquals(['a1'], checkout_tree.get_parent_ids())
86
84
        self.assertEquals('a1', wt.branch.last_revision())
87
 
        self.assertEquals('a2', wt.last_revision())
 
85
        self.assertEquals(['a2'], wt.get_parent_ids())
88
86
 
89
87
    def test_uncommit_bound(self):
90
88
        os.mkdir('a')
95
93
        t_a.commit('commit 1')
96
94
        t_a.commit('commit 2')
97
95
        t_a.commit('commit 3')
98
 
        b = t_a.bzrdir.sprout('b').open_branch()
99
 
        b.bind(t_a.branch)
 
96
        b = t_a.branch.create_checkout('b').branch
100
97
        uncommit.uncommit(b)
101
98
        self.assertEqual(len(b.revision_history()), 2)
102
99
        self.assertEqual(len(t_a.branch.revision_history()), 2)
115
112
 
116
113
        self.assertNotContainsRe(out, 'initial commit')
117
114
        self.assertContainsRe(out, 'second commit')
118
 
        self.assertEqual('a1', wt.last_revision())
 
115
        self.assertEqual(['a1'], wt.get_parent_ids())
119
116
        self.assertEqual('a1', wt.branch.last_revision())
120
117
 
121
118
    def test_uncommit_neg_1(self):
152
149
 
153
150
        os.chdir('tree')
154
151
        out, err = self.run_bzr('uncommit', '--force')
155
 
        self.assertEqual('a1', wt.last_revision())
156
 
        self.assertEqual(['b3'], wt.pending_merges())
 
152
        self.assertEqual(['a1', 'b3'], wt.get_parent_ids())
157
153
 
158
154
    def test_uncommit_multiple_merge(self):
159
155
        wt = self.create_simple_tree()
191
187
        wt.branch.fetch(tree2.branch)
192
188
        wt.set_pending_merges(['b4'])
193
189
 
194
 
        self.assertEqual('a3', wt.last_revision())
195
 
        self.assertEqual(['b4'], wt.pending_merges())
 
190
        self.assertEqual(['a3', 'b4'], wt.get_parent_ids())
196
191
 
197
192
        os.chdir('tree')
198
193
        out, err = self.run_bzr('uncommit', '--force', '-r', '2')
199
194
 
200
 
        self.assertEqual('a2', wt.last_revision())
201
 
        self.assertEqual(['b3', 'b4'], wt.pending_merges())
 
195
        self.assertEqual(['a2', 'b3', 'b4'], wt.get_parent_ids())
202
196
 
203
197
    def test_uncommit_octopus_merge(self):
204
198
        # Check that uncommit keeps the pending merges in the same order