138
138
self.check_branch()
140
def test_add_in_unversioned(self):
141
"""Try to add a file in an unversioned directory.
143
"bzr add" should add the parent(s) as necessary.
145
from bzrlib.branch import Branch
146
eq = self.assertEqual
148
b = Branch.initialize('.')
150
self.build_tree(['inertiatic/', 'inertiatic/esp'])
151
eq(list(b.unknowns()), ['inertiatic'])
152
self.run_bzr('add', 'inertiatic/esp')
153
eq(list(b.unknowns()), [])
155
# Multiple unversioned parents
156
self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt'])
157
eq(list(b.unknowns()), ['veil'])
158
self.run_bzr('add', 'veil/cerpin/taxt')
159
eq(list(b.unknowns()), [])
161
# Check whacky paths work
162
self.build_tree(['cicatriz/', 'cicatriz/esp'])
163
eq(list(b.unknowns()), ['cicatriz'])
164
self.run_bzr('add', 'inertiatic/../cicatriz/esp')
165
eq(list(b.unknowns()), [])
167
def test_add_in_versioned(self):
168
"""Try to add a file in a versioned directory.
170
"bzr add" should do this happily.
172
from bzrlib.branch import Branch
173
eq = self.assertEqual
175
b = Branch.initialize('.')
177
self.build_tree(['inertiatic/', 'inertiatic/esp'])
178
eq(list(b.unknowns()), ['inertiatic'])
179
self.run_bzr('add', '--no-recurse', 'inertiatic')
180
eq(list(b.unknowns()), ['inertiatic'+os.sep+'esp'])
181
self.run_bzr('add', 'inertiatic/esp')
182
eq(list(b.unknowns()), [])
184
def test_subdir_add(self):
185
"""Add in subdirectory should add only things from there down"""
187
from bzrlib.branch import Branch
189
eq = self.assertEqual
193
b = Branch.initialize('.')
195
self.build_tree(['src/', 'README'])
197
eq(sorted(b.unknowns()),
200
self.run_bzr('add', 'src')
202
self.build_tree(['src/foo.c'])
207
eq(sorted(b.unknowns()),
209
eq(len(t.read_working_inventory()), 3)
213
eq(list(b.unknowns()), [])
217
140
def check_branch(self):
218
141
"""After all the above changes, run the check and upgrade commands.