73
73
self.runbzr("--pants off", retcode=3)
74
74
self.runbzr("diff --message foo", retcode=3)
76
def test_ignore_patterns(self):
78
self.assertEquals(self.capture('unknowns'), '')
80
file('foo.c', 'wt').write('int main() {}')
81
self.assertEquals(self.capture('unknowns'), 'foo.c\n')
83
self.runbzr(['add', 'foo.c'])
84
self.assertEquals(self.capture('unknowns'), '')
86
# 'ignore' works when creating the .bzignore file
87
file('foo.blah', 'wt').write('blah')
88
self.assertEquals(self.capture('unknowns'), 'foo.blah\n')
89
self.runbzr('ignore *.blah')
90
self.assertEquals(self.capture('unknowns'), '')
91
self.assertEquals(file('.bzrignore', 'rU').read(), '*.blah\n')
93
# 'ignore' works when then .bzrignore file already exists
94
file('garh', 'wt').write('garh')
95
self.assertEquals(self.capture('unknowns'), 'garh\n')
96
self.runbzr('ignore garh')
97
self.assertEquals(self.capture('unknowns'), '')
98
self.assertEquals(file('.bzrignore', 'rU').read(), '*.blah\ngarh\n')
100
76
def test_revert(self):
101
77
self.runbzr('init')
238
214
bzr('commit -m add')
240
216
output_equals('a\n', '--kind', 'file')
241
output_equals('b\n', '--kind', 'directory')
244
"""Test the abilities of 'bzr ls'"""
246
def bzrout(*args, **kwargs):
247
kwargs['backtick'] = True
248
return self.runbzr(*args, **kwargs)
250
def ls_equals(value, *args):
251
out = self.runbzr(['ls'] + list(args), backtick=True)
252
self.assertEquals(out, value)
255
self.build_tree_contents(
256
[('.bzrignore', '*.pyo\n'),
261
bzr('ls --verbose --null', retcode=3)
263
ls_equals('.bzrignore\na\n')
264
ls_equals('? .bzrignore\n'
267
ls_equals('.bzrignore\n'
270
ls_equals('', '--ignored')
271
ls_equals('', '--versioned')
272
ls_equals('.bzrignore\n'
274
'--unknown', '--ignored', '--versioned')
275
ls_equals('', '--ignored', '--versioned')
276
ls_equals('.bzrignore\0a\0', '--null')
279
ls_equals('? .bzrignore\nV a\n', '--verbose')
283
ls_equals('? .bzrignore\n'
287
open('subdir/b', 'wb').write('b\n')
289
ls_equals('V .bzrignore\n'
294
bzr('commit -m subdir')
296
ls_equals('.bzrignore\n'
301
ls_equals('V .bzrignore\n'
304
, '--verbose', '--non-recursive')
306
# Check what happens in a sub-directory
311
ls_equals('.bzrignore\n'
316
ls_equals('.bzrignore\0'
320
, '--from-root', '--null')
321
ls_equals('.bzrignore\n'
324
, '--from-root', '--non-recursive')
328
# Check what happens when we supply a specific revision
329
ls_equals('a\n', '--revision', '1')
331
, '--verbose', '--revision', '1')
334
ls_equals('', '--revision', '1')
336
# Now try to do ignored files.
338
open('blah.py', 'wb').write('unknown\n')
339
open('blah.pyo', 'wb').write('ignored\n')
340
ls_equals('.bzrignore\n'
346
ls_equals('V .bzrignore\n'
353
ls_equals('blah.pyo\n'
355
ls_equals('blah.py\n'
357
ls_equals('.bzrignore\n'
365
file("myfile", "wb").write("My contents\n")
367
self.runbzr('commit -m myfile')
368
self.run_bzr_captured('cat -r 1 myfile'.split(' '))
217
output_equals('b\n', '--kind', 'directory')
370
219
def test_pull_verbose(self):
371
220
"""Pull changes from one branch to another and watch the output."""