15
17
self.runbzr('clean-tree')
16
18
assert os.path.lexists('name~')
17
19
assert not os.path.lexists('name')
18
21
self.runbzr('clean-tree --detritus')
22
assert os.path.lexists('name')
19
23
assert not os.path.lexists('name~')
20
24
assert os.path.lexists('name.pyc')
21
25
self.runbzr('clean-tree --ignored')
26
assert os.path.lexists('name')
27
assert not os.path.lexists('name.pyc')
28
self.runbzr('clean-tree --unknown')
29
assert not os.path.lexists('name')
32
self.touch('name.pyc')
33
self.runbzr('clean-tree --unknown --ignored')
34
assert not os.path.lexists('name')
35
assert not os.path.lexists('name~')
22
36
assert not os.path.lexists('name.pyc')
24
38
def test_shelve(self):
80
94
def test_zap_branch(self):
81
95
self.runbzr('init source')
82
96
self.runbzr('checkout --lightweight source checkout')
83
self.runbzr('zap --branch checkout')
84
self.assertIs(False, os.path.exists('checkout'))
85
self.assertIs(False, os.path.exists('source'))
97
self.runbzr('zap --branch checkout', retcode=3)
98
self.assertIs(True, os.path.exists('checkout'))
99
self.assertIs(True, os.path.exists('source'))
100
self.runbzr('branch source source2')
101
self.runbzr('checkout --lightweight source2 checkout2')
102
self.runbzr('zap --branch checkout2')
103
self.assertIs(False, os.path.exists('checkout2'))
104
self.assertIs(False, os.path.exists('source2'))
87
106
def test_branches(self):
88
107
self.runbzr('init source')
98
117
self.assertIs(True, 'checkout' not in lines)
99
118
self.assertIs(True, 'checkout/.bzr/subcheckout' not in lines)
120
def test_import_upstream(self):
121
self.runbzr('init source')
122
os.mkdir('source/src')
123
f = file('source/src/myfile', 'wb')
128
self.runbzr('commit -m hello')
129
self.runbzr('export ../source-0.1.tar.gz')
130
self.runbzr('export ../source-0.1.tar.bz2')
131
self.runbzr('init ../import')
132
os.chdir('../import')
133
self.runbzr('import ../source-0.1.tar.gz')
134
self.failUnlessExists('src/myfile')
135
result = self.runbzr('import ../source-0.1.tar.gz', retcode=3)[1]
136
self.assertContainsRe(result, 'Working tree has uncommitted changes')
137
self.runbzr('commit -m commit')
138
self.runbzr('import ../source-0.1.tar.gz')
140
self.runbzr('init import2')
141
self.runbzr('import source-0.1.tar.gz import2')
142
self.failUnlessExists('import2/src/myfile')
143
self.runbzr('import source-0.1.tar.gz import3')
144
self.failUnlessExists('import3/src/myfile')
145
self.runbzr('import source-0.1.tar.bz2 import4')
146
self.failUnlessExists('import4/src/myfile')
148
def test_shove(self):
149
self.runbzr('init source')
150
f = file('source/file', 'wb')
153
self.runbzr('add source/file')
154
self.runbzr('commit source -m foo')
155
self.runbzr('branch source target1')
156
self.runbzr('branch source target2')
157
f = file('source/file', 'wb')
160
self.runbzr('shove target1 source')
161
f = file('target1/file', 'rb')
162
self.assertEqual(f.read(), 'goodbye\n')
165
self.runbzr('shove target2', retcode=3)
166
self.runbzr('shove ../target2')
167
f = file('../target2/file', 'rb')
168
self.assertEqual(f.read(), 'goodbye\n')
101
171
def test_suite():
102
172
return makeSuite(TestBzrTools)