74
74
self.build_tree_contents(
75
75
[('foo.tmp', '.tmp files are ignored by default'),
77
self.assertEquals(self.run_bzr(['unknowns'])[0], '')
77
self.assertEquals(self.run_bzr('unknowns')[0], '')
79
79
file('foo.c', 'wt').write('int main() {}')
80
self.assertEquals(self.run_bzr(['unknowns'])[0], 'foo.c\n')
80
self.assertEquals(self.run_bzr('unknowns')[0], 'foo.c\n')
82
82
self.run_bzr('add foo.c')
83
self.assertEquals(self.run_bzr(['unknowns'])[0], '')
83
self.assertEquals(self.run_bzr('unknowns')[0], '')
85
85
# 'ignore' works when creating the .bzrignore file
86
86
file('foo.blah', 'wt').write('blah')
87
self.assertEquals(self.run_bzr(['unknowns'])[0], 'foo.blah\n')
87
self.assertEquals(self.run_bzr('unknowns')[0], 'foo.blah\n')
88
88
self.run_bzr('ignore *.blah')
89
self.assertEquals(self.run_bzr(['unknowns'])[0], '')
89
self.assertEquals(self.run_bzr('unknowns')[0], '')
90
90
self.check_file_contents('.bzrignore', '*.blah\n')
92
92
# 'ignore' works when then .bzrignore file already exists
93
93
file('garh', 'wt').write('garh')
94
self.assertEquals(self.run_bzr(['unknowns'])[0], 'garh\n')
94
self.assertEquals(self.run_bzr('unknowns')[0], 'garh\n')
95
95
self.run_bzr('ignore garh')
96
self.assertEquals(self.run_bzr(['unknowns'])[0], '')
96
self.assertEquals(self.run_bzr('unknowns')[0], '')
97
97
self.check_file_contents('.bzrignore', '*.blah\ngarh\n')
99
99
def test_ignore_multiple_arguments(self):
100
100
"""'ignore' works with multiple arguments"""
101
101
self.run_bzr('init')
102
102
self.build_tree(['a','b','c','d'])
103
self.assertEquals(self.run_bzr(['unknowns'])[0], 'a\nb\nc\nd\n')
103
self.assertEquals(self.run_bzr('unknowns')[0], 'a\nb\nc\nd\n')
104
104
self.run_bzr('ignore a b c')
105
self.assertEquals(self.run_bzr(['unknowns'])[0], 'd\n')
105
self.assertEquals(self.run_bzr('unknowns')[0], 'd\n')
106
106
self.check_file_contents('.bzrignore', 'a\nb\nc\n')
108
108
def test_ignore_no_arguments(self):
115
115
def test_ignore_old_defaults(self):
116
out, err = self.run_bzr('ignore', '--old-default-rules')
116
out, err = self.run_bzr('ignore --old-default-rules')
117
117
self.assertContainsRe(out, 'CVS')
118
118
self.assertEqual('', err)