~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2010-09-13 09:54:40 UTC
  • mto: This revision was merged to the branch mainline in revision 5426.
  • Revision ID: mbp@sourcefrog.net-20100913095440-1jn2gx58lrjpa823
Add a test that uncommit confirms its action

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
from bzrlib.tests.script import (
 
26
    run_script,
 
27
    ScriptRunner,
 
28
    )
26
29
 
27
30
 
28
31
class TestUncommit(TestCaseWithTransport):
61
64
        out, err = self.run_bzr('status')
62
65
        self.assertEquals(out, 'modified:\n  a\n')
63
66
 
 
67
    def test_uncommit_interactive(self):
 
68
        """Uncommit seeks confirmation, and doesn't proceed without it."""
 
69
        wt = self.create_simple_tree()
 
70
        os.chdir('tree')
 
71
        run_script(self, """    
 
72
        $ bzr uncommit
 
73
            2 jrandom@example.com\t...
 
74
              second commit
 
75
        
 
76
        The above revision(s) will be removed.
 
77
        2>Uncommit these revisions? [y/n]: 
 
78
        <n
 
79
        Canceled
 
80
        """)
 
81
        self.assertEqual(['a2'], wt.get_parent_ids())
 
82
 
64
83
    def test_uncommit_no_history(self):
65
84
        wt = self.make_branch_and_tree('tree')
66
85
        out, err = self.run_bzr('uncommit --force', retcode=1)