/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 with stacked-fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
110
110
        b.pull(t_a.branch)
111
111
        uncommit.uncommit(b)
112
112
 
 
113
    def test_uncommit_bound_local(self):
 
114
        t_a = self.make_branch_and_tree('a')
 
115
        rev_id1 = t_a.commit('commit 1')
 
116
        rev_id2 = t_a.commit('commit 2')
 
117
        rev_id3 = t_a.commit('commit 3')
 
118
        b = t_a.branch.create_checkout('b').branch
 
119
 
 
120
        out, err = self.run_bzr(['uncommit', '--local', 'b', '--force'])
 
121
        self.assertEqual(rev_id3, t_a.last_revision())
 
122
        self.assertEqual((3, rev_id3), t_a.branch.last_revision_info())
 
123
        self.assertEqual((2, rev_id2), b.last_revision_info())
 
124
 
113
125
    def test_uncommit_revision(self):
114
126
        wt = self.create_simple_tree()
115
127
 
161
173
        wt = self.create_simple_tree()
162
174
 
163
175
        tree2 = wt.bzrdir.sprout('tree2').open_workingtree()
164
 
 
165
176
        tree2.commit('unchanged', rev_id='b3')
166
177
 
 
178
        tree3 = wt.bzrdir.sprout('tree3').open_workingtree()
 
179
        tree3.commit('unchanged', rev_id='c3')
 
180
 
167
181
        wt.merge_from_branch(tree2.branch)
168
182
        wt.commit('merge b3', rev_id='a3')
169
183
 
170
 
        tree2.commit('unchanged', rev_id='b4')
171
 
 
172
 
        wt.merge_from_branch(tree2.branch)
173
 
        wt.commit('merge b4', rev_id='a4')
 
184
        wt.merge_from_branch(tree3.branch)
 
185
        wt.commit('merge c3', rev_id='a4')
174
186
 
175
187
        self.assertEqual(['a4'], wt.get_parent_ids())
176
188
 
177
189
        os.chdir('tree')
178
190
        out, err = self.run_bzr('uncommit --force -r 2')
179
191
 
180
 
        self.assertEqual(['a2', 'b3', 'b4'], wt.get_parent_ids())
 
192
        self.assertEqual(['a2', 'b3', 'c3'], wt.get_parent_ids())
181
193
 
182
194
    def test_uncommit_merge_plus_pending(self):
183
195
        wt = self.create_simple_tree()
184
196
 
185
197
        tree2 = wt.bzrdir.sprout('tree2').open_workingtree()
186
 
 
187
198
        tree2.commit('unchanged', rev_id='b3')
 
199
        tree3 = wt.bzrdir.sprout('tree3').open_workingtree()
 
200
        tree3.commit('unchanged', rev_id='c3')
 
201
 
188
202
        wt.branch.fetch(tree2.branch)
189
203
        wt.set_pending_merges(['b3'])
190
204
        wt.commit('merge b3', rev_id='a3')
191
205
 
192
 
        tree2.commit('unchanged', rev_id='b4')
193
 
        wt.branch.fetch(tree2.branch)
194
 
        wt.set_pending_merges(['b4'])
195
 
 
196
 
        self.assertEqual(['a3', 'b4'], wt.get_parent_ids())
 
206
 
 
207
        wt.merge_from_branch(tree3.branch)
 
208
 
 
209
        self.assertEqual(['a3', 'c3'], wt.get_parent_ids())
197
210
 
198
211
        os.chdir('tree')
199
212
        out, err = self.run_bzr('uncommit --force -r 2')
200
213
 
201
 
        self.assertEqual(['a2', 'b3', 'b4'], wt.get_parent_ids())
 
214
        self.assertEqual(['a2', 'b3', 'c3'], wt.get_parent_ids())
202
215
 
203
216
    def test_uncommit_octopus_merge(self):
204
217
        # Check that uncommit keeps the pending merges in the same order
 
218
        # though it will also filter out ones in the ancestry
205
219
        wt = self.create_simple_tree()
206
220
 
207
221
        tree2 = wt.bzrdir.sprout('tree2').open_workingtree()
226
240
        os.chdir('tree')
227
241
        out, err = self.run_bzr('uncommit --force -r 2')
228
242
 
229
 
        self.assertEqual(['a2', 'b3', 'c3', 'c4', 'b4'], wt.get_parent_ids())
 
243
        self.assertEqual(['a2', 'c4', 'b4'], wt.get_parent_ids())
230
244
 
231
245
    def test_uncommit_nonascii(self):
232
246
        tree = self.make_branch_and_tree('tree')