126
mypath = os.path.abspath(sys.argv[0])
127
print '%-30s %s' % ('running tests from', mypath)
131
if len(sys.argv) > 1:
132
BZRPATH = sys.argv[1]
134
BZRPATH = os.path.join(os.path.split(mypath)[0], 'bzr')
136
print '%-30s %s' % ('against bzr', BZRPATH)
137
print '%-30s %s' % ('in directory', os.getcwd())
139
print backtick([BZRPATH, 'version'])
141
123
runcmd(['mkdir', TESTDIR])
143
test_root = os.getcwd()
145
126
progress("introductory commands")
146
127
runcmd("bzr version")
160
138
progress("invalid commands")
161
139
runcmd("bzr pants", retcode=1)
162
140
runcmd("bzr --pants off", retcode=1)
163
runcmd("bzr diff --message foo", retcode=1)
165
142
progress("basic branch creation")
166
143
runcmd(['mkdir', 'branch1'])
168
145
runcmd('bzr init')
170
assert backtick('bzr root')[:-1] == os.path.join(test_root, 'branch1')
172
147
progress("status of new file")
174
149
f = file('test.txt', 'wt')
184
159
out = backtick("bzr status --all")
185
160
assert out == "? test.txt\n"
187
out = backtick("bzr status test.txt --all")
188
assert out == "? test.txt\n"
190
f = file('test2.txt', 'wt')
191
f.write('goodbye cruel world...\n')
194
out = backtick("bzr status test.txt")
195
assert out == "? test.txt\n"
197
out = backtick("bzr status")
198
assert out == "? test.txt\n" \
201
os.unlink('test2.txt')
203
progress("command aliases")
204
out = backtick("bzr st --all")
205
assert out == "? test.txt\n"
206
out = backtick("bzr stat")
207
assert out == "? test.txt\n"
209
progress("command help")
210
runcmd("bzr help st")
212
runcmd("bzr help commands")
213
runcmd("bzr help slartibartfast", 1)
215
out = backtick("bzr help ci")
216
out.index('aliases: ')
218
162
progress("can't rename unversioned file")
219
163
runcmd("bzr rename test.txt new-test.txt", 1)
264
207
runcmd(['bzr', 'commit', '-m', 'rename nested subdirectories'])
267
assert backtick('bzr root')[:-1] == os.path.join(test_root, 'branch1')
268
210
runcmd('bzr move ../hello.txt .')
269
211
assert exists('./hello.txt')
270
assert backtick('bzr relpath hello.txt') == 'sub1/sub2/hello.txt\n'
271
assert backtick('bzr relpath ../../sub1/sub2/hello.txt') == 'sub1/sub2/hello.txt\n'
272
212
runcmd(['bzr', 'commit', '-m', 'move to parent directory'])
274
assert backtick('bzr relpath sub2/hello.txt') == 'sub1/sub2/hello.txt\n'
276
215
runcmd('bzr move sub2/hello.txt .')
277
216
assert exists('hello.txt')
279
f = file('hello.txt', 'wt')
280
f.write('some nice new content\n')
283
f = file('msg.tmp', 'wt')
284
f.write('this is my new commit\n')
287
runcmd('bzr commit -F msg.tmp')
289
assert backtick('bzr revno') == '5\n'
290
runcmd('bzr export -r 5 export-5.tmp')
291
runcmd('bzr export export.tmp')
299
progress('ignore patterns')
300
mkdir('ignorebranch')
303
assert backtick('bzr unknowns') == ''
305
file('foo.tmp', 'wt').write('tmp files are ignored')
306
assert backtick('bzr unknowns') == ''
308
file('foo.c', 'wt').write('int main() {}')
309
assert backtick('bzr unknowns') == 'foo.c\n'
310
runcmd('bzr add foo.c')
311
assert backtick('bzr unknowns') == ''
313
file('foo.blah', 'wt').write('blah')
314
assert backtick('bzr unknowns') == 'foo.blah\n'
315
runcmd('bzr ignore *.blah')
316
assert backtick('bzr unknowns') == ''
317
assert file('.bzrignore', 'rt').read() == '*.blah\n'
320
221
progress("all tests passed!")
321
222
except Exception, e: