39
36
self.run_bzr('mkdir', 'foo')
40
37
self.assert_(os.path.isdir('foo'))
42
self.run_bzr('mkdir', 'foo', retcode=2)
39
self.run_bzr('mkdir', 'foo', retcode=3)
44
41
from bzrlib.diff import compare_trees
45
42
from bzrlib.branch import Branch
53
50
self.assertEquals(delta.added[0][0], 'foo')
54
51
self.failIf(delta.modified)
53
def test_mkdir_in_subdir(self):
54
"""'bzr mkdir' operation in subdirectory"""
57
self.run_bzr('mkdir', 'dir')
58
self.assert_(os.path.isdir('dir'))
61
self.log('Run mkdir in subdir')
62
self.run_bzr('mkdir', 'subdir')
63
self.assert_(os.path.isdir('subdir'))
66
from bzrlib.diff import compare_trees
67
from bzrlib.branch import Branch
70
delta = compare_trees(b.basis_tree(), b.working_tree())
72
self.log('delta.added = %r' % delta.added)
74
self.assertEquals(len(delta.added), 2)
75
self.assertEquals(delta.added[0][0], 'dir')
76
self.assertEquals(delta.added[1][0], os.path.join('dir','subdir'))
77
self.failIf(delta.modified)
79
def test_mkdir_w_nested_trees(self):
80
"""'bzr mkdir' with nested trees"""
91
self.run_bzr('mkdir', 'dir', 'a/dir', 'a/b/dir')
92
self.failUnless(os.path.isdir('dir'))
93
self.failUnless(os.path.isdir('a/dir'))
94
self.failUnless(os.path.isdir('a/b/dir'))
96
from bzrlib.diff import compare_trees
98
b_a = Branch.open('a')
99
b_b = Branch.open('a/b')
101
delta = compare_trees(b.basis_tree(), b.working_tree())
102
self.assertEquals(len(delta.added), 1)
103
self.assertEquals(delta.added[0][0], 'dir')
104
self.failIf(delta.modified)
106
delta = compare_trees(b_a.basis_tree(), b_a.working_tree())
107
self.assertEquals(len(delta.added), 1)
108
self.assertEquals(delta.added[0][0], 'dir')
109
self.failIf(delta.modified)
111
delta = compare_trees(b_b.basis_tree(), b_b.working_tree())
112
self.assertEquals(len(delta.added), 1)
113
self.assertEquals(delta.added[0][0], 'dir')
114
self.failIf(delta.modified)
56
116
def test_branch_add_in_unversioned(self):
57
117
"""Try to add a file in an unversioned directory.
156
216
The upgrade should be a no-op."""
157
217
b = Branch.open('.')
158
debug('branch has %d revisions', b.revno())
218
mutter('branch has %d revisions', b.revno())
160
debug('check branch...')
220
mutter('check branch...')
161
221
from bzrlib.check import check
166
225
class SubdirCommit(TestCaseInTempDir):
168
227
def test_subdir_commit(self):
184
243
for fn in ('a/one', 'b/two', 'top'):
185
244
file(fn, 'w').write('new contents')
187
debug('start selective subdir commit')
246
mutter('start selective subdir commit')
188
247
run_bzr('commit', 'a', '-m', 'commit a only')
190
249
old = b.revision_tree(b.get_rev_id(1))