2
Test the uncommit command.
7
from bzrlib.errors import BzrError
8
from bzrlib.tests import TestCaseInTempDir
10
class TestUncommit(TestCaseInTempDir):
11
def test_uncommit(self):
12
"""Test uncommit functionality."""
17
self.build_tree(['a', 'b', 'c'])
20
bzr('commit -m initial')
22
self.assertEquals(bzr('revno'), '1\n')
24
open('a', 'wb').write('new contents of a\n')
25
self.assertEquals(bzr('status'), 'modified:\n a\n')
26
bzr('commit -m second')
28
self.assertEquals(bzr('status'), '')
29
self.assertEquals(bzr('revno'), '2\n')
31
txt = bzr('uncommit --dry-run --force')
32
self.failIfEqual(txt.find('Dry-run'), -1)
34
self.assertEquals(bzr('status'), '')
35
self.assertEquals(bzr('revno'), '2\n')
37
txt = bzr('uncommit --force')
39
self.assertEquals(bzr('revno'), '1\n')
40
self.assertEquals(bzr('status'), 'modified:\n a\n')
42
bzr('checkout . ../checkout')
43
os.chdir('../checkout')
44
self.assertEquals("", bzr('status'))
45
self.assertEquals(bzr('revno'), '1\n')
47
open('a', 'wb').write('new contents of a\n')
48
self.assertEquals(bzr('status'), 'modified:\n a\n')
49
bzr('commit -m second')
51
self.assertEquals(bzr('status'), '')
52
self.assertEquals(bzr('revno'), '2\n')
54
txt = bzr('uncommit --dry-run --force')
55
self.failIfEqual(txt.find('Dry-run'), -1)
57
self.assertEquals(bzr('status'), '')
58
self.assertEquals(bzr('revno'), '2\n')
60
txt = bzr('uncommit --force')
62
self.assertEquals(bzr('revno'), '1\n')
63
self.assertEquals(bzr('status'), 'modified:\n a\n')