~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_uncommit.py

  • Committer: Robert Collins
  • Date: 2006-01-05 22:30:59 UTC
  • mto: (1534.1.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1536.
  • Revision ID: robertc@robertcollins.net-20060105223059-a8b64f7b47cf12fb
 * bzrlib.osutils.safe_unicode now exists to provide parameter coercion
   for functions that need unicode strings. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""\
 
2
Test the uncommit command.
 
3
"""
 
4
from bzrlib.tests import TestCaseInTempDir
 
5
from bzrlib.errors import BzrError
 
6
 
 
7
class TestUncommit(TestCaseInTempDir):
 
8
    def test_uncommit(self):
 
9
        """Test uncommit functionality."""
 
10
        bzr = self.capture 
 
11
 
 
12
        bzr('init')
 
13
        self.build_tree(['a', 'b', 'c'])
 
14
 
 
15
        bzr('add')
 
16
        bzr('commit -m initial')
 
17
 
 
18
        self.assertEquals(bzr('revno'), '1\n')
 
19
 
 
20
        open('a', 'wb').write('new contents of a\n')
 
21
        self.assertEquals(bzr('status'), 'modified:\n  a\n')
 
22
        bzr('commit -m second')
 
23
 
 
24
        self.assertEquals(bzr('status'), '')
 
25
        self.assertEquals(bzr('revno'), '2\n')
 
26
 
 
27
        txt = bzr('uncommit --dry-run --force')
 
28
        self.failIfEqual(txt.find('Dry-run'), -1)
 
29
 
 
30
        self.assertEquals(bzr('status'), '')
 
31
        self.assertEquals(bzr('revno'), '2\n')
 
32
 
 
33
        txt = bzr('uncommit --force')
 
34
 
 
35
        self.assertEquals(bzr('revno'), '1\n')
 
36
        self.assertEquals(bzr('status'), 'modified:\n  a\n')
 
37