35
35
def test_mkdir(self):
36
36
"""Basic 'bzr mkdir' operation"""
37
from bzrlib.commands import run_bzr
39
self.run_bzr('mkdir', 'foo')
40
run_bzr(['mkdir', 'foo'])
40
41
self.assert_(os.path.isdir('foo'))
42
self.run_bzr('mkdir', 'foo', retcode=2)
43
self.assertRaises(OSError, run_bzr, ['mkdir', 'foo'])
44
45
from bzrlib.diff import compare_trees
45
46
from bzrlib.branch import Branch
74
75
self.check_branch()
76
78
def test_add_in_unversioned(self):
77
79
"""Try to add a file in an unversioned directory.
79
81
"bzr add" should add the parent(s) as necessary.
81
83
from bzrlib.branch import Branch
84
from bzrlib.commands import run_bzr
82
85
eq = self.assertEqual
84
87
b = Branch.initialize('.')
86
89
self.build_tree(['inertiatic/', 'inertiatic/esp'])
87
90
eq(list(b.unknowns()), ['inertiatic'])
88
self.run_bzr('add', 'inertiatic/esp')
91
run_bzr(['add', 'inertiatic/esp'])
89
92
eq(list(b.unknowns()), [])
91
94
# Multiple unversioned parents
92
95
self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt'])
93
96
eq(list(b.unknowns()), ['veil'])
94
self.run_bzr('add', 'veil/cerpin/taxt')
97
run_bzr(['add', 'veil/cerpin/taxt'])
95
98
eq(list(b.unknowns()), [])
97
100
# Check whacky paths work
98
101
self.build_tree(['cicatriz/', 'cicatriz/esp'])
99
102
eq(list(b.unknowns()), ['cicatriz'])
100
self.run_bzr('add', 'inertiatic/../cicatriz/esp')
103
run_bzr(['add', 'inertiatic/../cicatriz/esp'])
101
104
eq(list(b.unknowns()), [])
103
106
def test_add_in_versioned(self):
106
109
"bzr add" should do this happily.
108
111
from bzrlib.branch import Branch
112
from bzrlib.commands import run_bzr
109
113
eq = self.assertEqual
111
115
b = Branch.initialize('.')
113
117
self.build_tree(['inertiatic/', 'inertiatic/esp'])
114
118
eq(list(b.unknowns()), ['inertiatic'])
115
self.run_bzr('add', '--no-recurse', 'inertiatic')
119
run_bzr(['add', '--no-recurse', 'inertiatic'])
116
120
eq(list(b.unknowns()), ['inertiatic'+os.sep+'esp'])
117
self.run_bzr('add', 'inertiatic/esp')
121
run_bzr(['add', 'inertiatic/esp'])
118
122
eq(list(b.unknowns()), [])
120
124
def test_subdir_add(self):
121
125
"""Add in subdirectory should add only things from there down"""
123
127
from bzrlib.branch import Branch
128
from bzrlib.commands import run_bzr
125
130
eq = self.assertEqual
126
131
ass = self.assert_
132
137
eq(sorted(b.unknowns()),
133
138
['README', 'src'])
135
self.run_bzr('add', 'src')
140
eq(run_bzr(['add', 'src']), 0)
137
142
self.build_tree(['src/foo.c'])
145
eq(run_bzr(['add']), 0)
142
147
eq(sorted(b.unknowns()),
144
149
eq(len(b.inventory), 3)
152
eq(run_bzr(['add']), 0)
148
153
eq(list(b.unknowns()), [])
150
155
self.check_branch()
152
158
def check_branch(self):
153
159
"""After all the above changes, run the check and upgrade commands.