0.3.11
by John Arbash Meinel
Updated to latest bzr.dev code, and added tests. |
1 |
"""\
|
2 |
Test the uncommit command.
|
|
3 |
"""
|
|
1558.1.12
by Aaron Bentley
Got uncommit working properly with checkouts |
4 |
|
5 |
import os |
|
6 |
||
7 |
from bzrlib.errors import BzrError |
|
1185.31.25
by John Arbash Meinel
Renamed all of the tests from selftest/foo.py to tests/test_foo.py |
8 |
from bzrlib.tests import TestCaseInTempDir |
0.3.11
by John Arbash Meinel
Updated to latest bzr.dev code, and added tests. |
9 |
|
10 |
class TestUncommit(TestCaseInTempDir): |
|
11 |
def test_uncommit(self): |
|
12 |
"""Test uncommit functionality."""
|
|
13 |
bzr = self.capture |
|
1558.1.12
by Aaron Bentley
Got uncommit working properly with checkouts |
14 |
os.mkdir('branch') |
15 |
os.chdir('branch') |
|
0.3.11
by John Arbash Meinel
Updated to latest bzr.dev code, and added tests. |
16 |
bzr('init') |
17 |
self.build_tree(['a', 'b', 'c']) |
|
18 |
||
19 |
bzr('add') |
|
20 |
bzr('commit -m initial') |
|
21 |
||
22 |
self.assertEquals(bzr('revno'), '1\n') |
|
23 |
||
24 |
open('a', 'wb').write('new contents of a\n') |
|
25 |
self.assertEquals(bzr('status'), 'modified:\n a\n') |
|
26 |
bzr('commit -m second') |
|
27 |
||
28 |
self.assertEquals(bzr('status'), '') |
|
29 |
self.assertEquals(bzr('revno'), '2\n') |
|
30 |
||
31 |
txt = bzr('uncommit --dry-run --force') |
|
32 |
self.failIfEqual(txt.find('Dry-run'), -1) |
|
33 |
||
34 |
self.assertEquals(bzr('status'), '') |
|
35 |
self.assertEquals(bzr('revno'), '2\n') |
|
36 |
||
37 |
txt = bzr('uncommit --force') |
|
38 |
||
39 |
self.assertEquals(bzr('revno'), '1\n') |
|
40 |
self.assertEquals(bzr('status'), 'modified:\n a\n') |
|
1558.1.12
by Aaron Bentley
Got uncommit working properly with checkouts |
41 |
|
42 |
bzr('checkout . ../checkout') |
|
43 |
os.chdir('../checkout') |
|
44 |
self.assertEquals("", bzr('status')) |
|
45 |
self.assertEquals(bzr('revno'), '1\n') |
|
46 |
||
47 |
open('a', 'wb').write('new contents of a\n') |
|
48 |
self.assertEquals(bzr('status'), 'modified:\n a\n') |
|
49 |
bzr('commit -m second') |
|
50 |
||
51 |
self.assertEquals(bzr('status'), '') |
|
52 |
self.assertEquals(bzr('revno'), '2\n') |
|
53 |
||
54 |
txt = bzr('uncommit --dry-run --force') |
|
55 |
self.failIfEqual(txt.find('Dry-run'), -1) |
|
56 |
||
57 |
self.assertEquals(bzr('status'), '') |
|
58 |
self.assertEquals(bzr('revno'), '2\n') |
|
59 |
||
60 |
txt = bzr('uncommit --force') |
|
61 |
||
62 |
self.assertEquals(bzr('revno'), '1\n') |
|
63 |
self.assertEquals(bzr('status'), 'modified:\n a\n') |