173
173
wt = self.create_simple_tree()
175
175
tree2 = wt.bzrdir.sprout('tree2').open_workingtree()
177
176
tree2.commit('unchanged', rev_id='b3')
178
tree3 = wt.bzrdir.sprout('tree3').open_workingtree()
179
tree3.commit('unchanged', rev_id='c3')
179
181
wt.merge_from_branch(tree2.branch)
180
182
wt.commit('merge b3', rev_id='a3')
182
tree2.commit('unchanged', rev_id='b4')
184
wt.merge_from_branch(tree2.branch)
185
wt.commit('merge b4', rev_id='a4')
184
wt.merge_from_branch(tree3.branch)
185
wt.commit('merge c3', rev_id='a4')
187
187
self.assertEqual(['a4'], wt.get_parent_ids())
190
190
out, err = self.run_bzr('uncommit --force -r 2')
192
self.assertEqual(['a2', 'b3', 'b4'], wt.get_parent_ids())
192
self.assertEqual(['a2', 'b3', 'c3'], wt.get_parent_ids())
194
194
def test_uncommit_merge_plus_pending(self):
195
195
wt = self.create_simple_tree()
197
197
tree2 = wt.bzrdir.sprout('tree2').open_workingtree()
199
198
tree2.commit('unchanged', rev_id='b3')
199
tree3 = wt.bzrdir.sprout('tree3').open_workingtree()
200
tree3.commit('unchanged', rev_id='c3')
200
202
wt.branch.fetch(tree2.branch)
201
203
wt.set_pending_merges(['b3'])
202
204
wt.commit('merge b3', rev_id='a3')
204
tree2.commit('unchanged', rev_id='b4')
205
wt.branch.fetch(tree2.branch)
206
wt.set_pending_merges(['b4'])
208
self.assertEqual(['a3', 'b4'], wt.get_parent_ids())
207
wt.merge_from_branch(tree3.branch)
209
self.assertEqual(['a3', 'c3'], wt.get_parent_ids())
211
212
out, err = self.run_bzr('uncommit --force -r 2')
213
self.assertEqual(['a2', 'b3', 'b4'], wt.get_parent_ids())
214
self.assertEqual(['a2', 'b3', 'c3'], wt.get_parent_ids())
215
216
def test_uncommit_octopus_merge(self):
216
217
# Check that uncommit keeps the pending merges in the same order
218
# though it will also filter out ones in the ancestry
217
219
wt = self.create_simple_tree()
219
221
tree2 = wt.bzrdir.sprout('tree2').open_workingtree()
239
241
out, err = self.run_bzr('uncommit --force -r 2')
241
self.assertEqual(['a2', 'b3', 'c3', 'c4', 'b4'], wt.get_parent_ids())
243
self.assertEqual(['a2', 'c4', 'b4'], wt.get_parent_ids())
243
245
def test_uncommit_nonascii(self):
244
246
tree = self.make_branch_and_tree('tree')