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
79
80
"bzr add" should add the parent(s) as necessary.
81
82
from bzrlib.branch import Branch
83
from bzrlib.commands import run_bzr
82
84
eq = self.assertEqual
84
86
b = Branch.initialize('.')
86
88
self.build_tree(['inertiatic/', 'inertiatic/esp'])
87
89
eq(list(b.unknowns()), ['inertiatic'])
88
self.run_bzr('add', 'inertiatic/esp')
90
run_bzr(['add', 'inertiatic/esp'])
89
91
eq(list(b.unknowns()), [])
91
93
# Multiple unversioned parents
92
94
self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt'])
93
95
eq(list(b.unknowns()), ['veil'])
94
self.run_bzr('add', 'veil/cerpin/taxt')
96
run_bzr(['add', 'veil/cerpin/taxt'])
95
97
eq(list(b.unknowns()), [])
97
99
# Check whacky paths work
98
100
self.build_tree(['cicatriz/', 'cicatriz/esp'])
99
101
eq(list(b.unknowns()), ['cicatriz'])
100
self.run_bzr('add', 'inertiatic/../cicatriz/esp')
102
run_bzr(['add', 'inertiatic/../cicatriz/esp'])
101
103
eq(list(b.unknowns()), [])
103
105
def test_add_in_versioned(self):
106
108
"bzr add" should do this happily.
108
110
from bzrlib.branch import Branch
111
from bzrlib.commands import run_bzr
109
112
eq = self.assertEqual
111
114
b = Branch.initialize('.')
113
116
self.build_tree(['inertiatic/', 'inertiatic/esp'])
114
117
eq(list(b.unknowns()), ['inertiatic'])
115
self.run_bzr('add', '--no-recurse', 'inertiatic')
118
run_bzr(['add', '--no-recurse', 'inertiatic'])
116
119
eq(list(b.unknowns()), ['inertiatic'+os.sep+'esp'])
117
self.run_bzr('add', 'inertiatic/esp')
120
run_bzr(['add', 'inertiatic/esp'])
118
121
eq(list(b.unknowns()), [])
120
123
def test_subdir_add(self):
121
124
"""Add in subdirectory should add only things from there down"""
123
126
from bzrlib.branch import Branch
127
from bzrlib.commands import run_bzr
125
129
eq = self.assertEqual
126
130
ass = self.assert_
132
136
eq(sorted(b.unknowns()),
133
137
['README', 'src'])
135
self.run_bzr('add', 'src')
139
eq(run_bzr(['add', 'src']), 0)
137
141
self.build_tree(['src/foo.c'])
144
eq(run_bzr(['add']), 0)
142
146
eq(sorted(b.unknowns()),
144
148
eq(len(b.inventory), 3)
151
eq(run_bzr(['add']), 0)
148
152
eq(list(b.unknowns()), [])
150
154
self.check_branch()