29
29
self.run_bzr('init')
30
30
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt', 'CVS'])
31
31
self.build_tree_contents([('.bzrignore', 'CVS\n')])
32
out = self.run_bzr('add')[0]
32
out = self.run_bzr(['add'], retcode=0)[0]
33
33
# the ordering is not defined at the moment
34
34
results = sorted(out.rstrip('\n').split('\n'))
35
35
self.assertEquals(['If you wish to add some of these files, please'\
41
41
'ignored 1 file(s).'],
43
out = self.run_bzr('add -v')[0]
43
out = self.run_bzr(['add', '-v'], retcode=0)[0]
44
44
results = sorted(out.rstrip('\n').split('\n'))
45
45
self.assertEquals(['If you wish to add some of these files, please'\
46
46
' add them by name.',
51
51
"""add -q does not print the names of added files."""
52
52
self.run_bzr('init')
53
53
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt'])
54
out = self.run_bzr('add -q')[0]
54
out = self.run_bzr(['add', '-q'], retcode=0)[0]
55
55
# the ordering is not defined at the moment
56
56
results = sorted(out.rstrip('\n').split('\n'))
57
57
self.assertEquals([''], results)
64
64
self.run_bzr('init')
65
65
self.build_tree(['inertiatic/', 'inertiatic/esp'])
66
self.assertEquals(self.run_bzr('unknowns')[0], 'inertiatic\n')
66
self.assertEquals(self.run_bzr(['unknowns'])[0], 'inertiatic\n')
67
67
self.run_bzr('add inertiatic/esp')
68
self.assertEquals(self.run_bzr('unknowns')[0], '')
68
self.assertEquals(self.run_bzr(['unknowns'])[0], '')
70
70
# Multiple unversioned parents
71
71
self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt'])
72
self.assertEquals(self.run_bzr('unknowns')[0], 'veil\n')
72
self.assertEquals(self.run_bzr(['unknowns'])[0], 'veil\n')
73
73
self.run_bzr('add veil/cerpin/taxt')
74
self.assertEquals(self.run_bzr('unknowns')[0], '')
74
self.assertEquals(self.run_bzr(['unknowns'])[0], '')
76
76
# Check whacky paths work
77
77
self.build_tree(['cicatriz/', 'cicatriz/esp'])
78
self.assertEquals(self.run_bzr('unknowns')[0], 'cicatriz\n')
78
self.assertEquals(self.run_bzr(['unknowns'])[0], 'cicatriz\n')
79
79
self.run_bzr('add inertiatic/../cicatriz/esp')
80
self.assertEquals(self.run_bzr('unknowns')[0], '')
80
self.assertEquals(self.run_bzr(['unknowns'])[0], '')
82
82
def test_add_in_versioned(self):
83
83
"""Try to add a file in a versioned directory.
87
87
self.run_bzr('init')
88
88
self.build_tree(['inertiatic/', 'inertiatic/esp'])
89
self.assertEquals(self.run_bzr('unknowns')[0], 'inertiatic\n')
89
self.assertEquals(self.run_bzr(['unknowns'])[0], 'inertiatic\n')
90
90
self.run_bzr('add --no-recurse inertiatic')
91
self.assertEquals(self.run_bzr('unknowns')[0], 'inertiatic/esp\n')
91
self.assertEquals(self.run_bzr(['unknowns'])[0], 'inertiatic/esp\n')
92
92
self.run_bzr('add inertiatic/esp')
93
self.assertEquals(self.run_bzr('unknowns')[0], '')
93
self.assertEquals(self.run_bzr(['unknowns'])[0], '')
95
95
def test_subdir_add(self):
96
96
"""Add in subdirectory should add only things from there down"""
117
117
self.run_bzr('add')
118
self.assertEquals(self.run_bzr('unknowns')[0], 'README\n')
118
self.assertEquals(self.run_bzr(['unknowns'])[0], 'README\n')
119
119
# reopen to see the new changes
120
120
t = t.bzrdir.open_workingtree()
121
121
versioned = [path for path, entry in t.iter_entries_by_dir()]
125
125
# add from the parent directory should pick up all file names
127
127
self.run_bzr('add')
128
self.assertEquals(self.run_bzr('unknowns')[0], '')
128
self.assertEquals(self.run_bzr(['unknowns'])[0], '')
129
129
self.run_bzr('check')
131
131
def test_add_missing(self):
175
175
self.assertEqual(base_tree.path2id('b/d'), new_tree.path2id('d'))
177
177
def test_add_dry_run(self):
178
"""Test a dry run add, make sure nothing is added."""
179
wt = self.make_branch_and_tree('.')
180
self.build_tree(['inertiatic/', 'inertiatic/esp'])
181
self.assertEqual(list(wt.unknowns()), ['inertiatic'])
182
self.run_bzr('add --dry-run')
183
self.assertEqual(list(wt.unknowns()), ['inertiatic'])
178
# ensure that --dry-run actually don't add anything
179
base_tree = self.make_branch_and_tree('.')
180
self.build_tree(['spam'])
181
out = self.run_bzr(['add', '--dry-run'], retcode=0)[0]
182
self.assertEquals('added spam\n', out)
183
out = self.run_bzr(['added'], retcode=0)[0]
184
self.assertEquals('', out)
185
186
def test_add_control_dir(self):
186
187
"""The control dir and its content should be refused."""