27
27
def test_add_reports(self):
28
28
"""add command prints the names of added files."""
30
30
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt', 'CVS'])
31
31
self.build_tree_contents([('.bzrignore', 'CVS\n')])
32
32
out = self.run_bzr_captured(['add'], retcode=0)[0]
50
50
def test_add_quiet_is(self):
51
51
"""add -q does not print the names of added files."""
53
53
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt'])
54
54
out = self.run_bzr_captured(['add', '-q'], retcode=0)[0]
55
55
# the ordering is not defined at the moment
62
62
"bzr add" should add the parent(s) as necessary.
65
65
self.build_tree(['inertiatic/', 'inertiatic/esp'])
66
self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
66
self.assertEquals(self.run_bzr_captured(['unknowns'])[0], 'inertiatic\n')
67
67
self.run_bzr('add', 'inertiatic/esp')
68
self.assertEquals(self.capture('unknowns'), '')
68
self.assertEquals(self.run_bzr_captured(['unknowns'])[0], '')
70
70
# Multiple unversioned parents
71
71
self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt'])
72
self.assertEquals(self.capture('unknowns'), 'veil\n')
72
self.assertEquals(self.run_bzr_captured(['unknowns'])[0], 'veil\n')
73
73
self.run_bzr('add', 'veil/cerpin/taxt')
74
self.assertEquals(self.capture('unknowns'), '')
74
self.assertEquals(self.run_bzr_captured(['unknowns'])[0], '')
76
76
# Check whacky paths work
77
77
self.build_tree(['cicatriz/', 'cicatriz/esp'])
78
self.assertEquals(self.capture('unknowns'), 'cicatriz\n')
78
self.assertEquals(self.run_bzr_captured(['unknowns'])[0], 'cicatriz\n')
79
79
self.run_bzr('add', 'inertiatic/../cicatriz/esp')
80
self.assertEquals(self.capture('unknowns'), '')
80
self.assertEquals(self.run_bzr_captured(['unknowns'])[0], '')
82
82
def test_add_in_versioned(self):
83
83
"""Try to add a file in a versioned directory.
85
85
"bzr add" should do this happily.
88
88
self.build_tree(['inertiatic/', 'inertiatic/esp'])
89
self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
89
self.assertEquals(self.run_bzr_captured(['unknowns'])[0], 'inertiatic\n')
90
90
self.run_bzr('add', '--no-recurse', 'inertiatic')
91
self.assertEquals(self.capture('unknowns'), 'inertiatic/esp\n')
91
self.assertEquals(self.run_bzr_captured(['unknowns'])[0], 'inertiatic/esp\n')
92
92
self.run_bzr('add', 'inertiatic/esp')
93
self.assertEquals(self.capture('unknowns'), '')
93
self.assertEquals(self.run_bzr_captured(['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.capture('unknowns'), 'README\n')
118
self.assertEquals(self.run_bzr_captured(['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()]