~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_uncommit.py

  • Committer: Martin Pool
  • Date: 2006-01-13 06:31:42 UTC
  • Revision ID: mbp@sourcefrog.net-20060113063142-8e706dc1483c69e1
Bump version to 0.8pre

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