~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_uncommit.py

  • Committer: Vincent Ladeuil
  • Date: 2010-02-10 15:46:03 UTC
  • mfrom: (4985.3.21 update)
  • mto: This revision was merged to the branch mainline in revision 5021.
  • Revision ID: v.ladeuil+lp@free.fr-20100210154603-k4no1gvfuqpzrw7p
Update performs two merges in a more logical order but stop on conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2008 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008, 2010 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
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Test the uncommit command."""
18
18
 
22
22
from bzrlib.bzrdir import BzrDirMetaFormat1
23
23
from bzrlib.errors import BzrError, BoundBranchOutOfDate
24
24
from bzrlib.tests import TestCaseWithTransport
 
25
from bzrlib.tests.script import ScriptRunner
25
26
 
26
27
 
27
28
class TestUncommit(TestCaseWithTransport):
103
104
        uncommit.uncommit(b)
104
105
        self.assertEqual(len(b.revision_history()), 2)
105
106
        self.assertEqual(len(t_a.branch.revision_history()), 2)
106
 
        # update A's tree to not have the uncomitted revision referenced.
 
107
        # update A's tree to not have the uncommitted revision referenced.
107
108
        t_a.update()
108
109
        t_a.commit('commit 3b')
109
110
        self.assertRaises(BoundBranchOutOfDate, uncommit.uncommit, b)
215
216
 
216
217
    def test_uncommit_shows_log_with_revision_id(self):
217
218
        wt = self.create_simple_tree()
218
 
 
219
 
        out, err = self.run_bzr('uncommit --force', working_dir='tree')
220
 
        self.assertContainsRe(out, r'second commit')
221
 
        self.assertContainsRe(err, r'You can restore the old tip by running')
222
 
        self.assertContainsRe(err, r'bzr pull . -r revid:a2')
 
219
        
 
220
        script = ScriptRunner()
 
221
        script.run_script(self, """
 
222
$ cd tree
 
223
$ bzr uncommit --force 
 
224
    2 ...
 
225
      second commit
 
226
...
 
227
The above revision(s) will be removed.
 
228
You can restore the old tip by running:
 
229
  bzr pull . -r revid:a2
 
230
""")
223
231
 
224
232
    def test_uncommit_octopus_merge(self):
225
233
        # Check that uncommit keeps the pending merges in the same order
233
241
        tree3.commit('unchanged', rev_id='c3')
234
242
 
235
243
        wt.merge_from_branch(tree2.branch)
236
 
        wt.merge_from_branch(tree3.branch)
 
244
        wt.merge_from_branch(tree3.branch, force=True)
237
245
        wt.commit('merge b3, c3', rev_id='a3')
238
246
 
239
247
        tree2.commit('unchanged', rev_id='b4')
240
248
        tree3.commit('unchanged', rev_id='c4')
241
249
 
242
250
        wt.merge_from_branch(tree3.branch)
243
 
        wt.merge_from_branch(tree2.branch)
 
251
        wt.merge_from_branch(tree2.branch, force=True)
244
252
        wt.commit('merge b4, c4', rev_id='a4')
245
253
 
246
254
        self.assertEqual(['a4'], wt.get_parent_ids())