~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_ignore.py

  • Committer: Marius Kruger
  • Date: 2007-06-27 18:48:10 UTC
  • mfrom: (2557 +trunk)
  • mto: (2605.1.1 rm-renamed)
  • mto: This revision was merged to the branch mainline in revision 2609.
  • Revision ID: marius.kruger@enerweb.co.za-20070627184810-4jq1y5f20xafow9w
Merge with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
 
46
46
    def test_ignore_absolutes(self):
47
47
        """'ignore' with an absolute path returns an error"""
48
 
        self.runbzr('init')
 
48
        self.run_bzr('init')
49
49
        self.run_bzr_error(('bzr: ERROR: NAME_PATTERN should not '
50
50
                            'be an absolute path\n',),
51
51
                           'ignore','/crud')
55
55
 
56
56
        Also check that trailing slashes on directories are stripped.
57
57
        """
58
 
        self.runbzr('init')
 
58
        self.run_bzr('init')
59
59
        self.build_tree(['dir1/', 'dir1/foo',
60
60
                         'dir2/', 'dir2/bar',
61
61
                         'dir3/', 'dir3/baz'])
62
 
        self.runbzr('ignore dir1 dir2/ dir4\\')
 
62
        self.run_bzr(['ignore', 'dir1', 'dir2/', 'dir4\\'])
63
63
        self.check_file_contents('.bzrignore', 'dir1\ndir2\ndir4\n')
64
 
        self.assertEquals(self.capture('unknowns'), 'dir3\n')
 
64
        self.assertEquals(self.run_bzr('unknowns')[0], 'dir3\n')
65
65
 
66
66
    def test_ignore_patterns(self):
67
 
        self.runbzr('init')
68
 
        self.assertEquals(self.capture('unknowns'), '')
 
67
        self.run_bzr('init')
 
68
        self.assertEquals(self.run_bzr(['unknowns'])[0], '')
69
69
 
70
70
        # is_ignored() will now create the user global ignore file
71
71
        # if it doesn't exist, so make sure we ignore it in our tests
74
74
        self.build_tree_contents(
75
75
            [('foo.tmp', '.tmp files are ignored by default'),
76
76
             ])
77
 
        self.assertEquals(self.capture('unknowns'), '')
 
77
        self.assertEquals(self.run_bzr(['unknowns'])[0], '')
78
78
 
79
79
        file('foo.c', 'wt').write('int main() {}')
80
 
        self.assertEquals(self.capture('unknowns'), 'foo.c\n')
 
80
        self.assertEquals(self.run_bzr(['unknowns'])[0], 'foo.c\n')
81
81
 
82
 
        self.runbzr(['add', 'foo.c'])
83
 
        self.assertEquals(self.capture('unknowns'), '')
 
82
        self.run_bzr('add foo.c')
 
83
        self.assertEquals(self.run_bzr(['unknowns'])[0], '')
84
84
 
85
85
        # 'ignore' works when creating the .bzrignore file
86
86
        file('foo.blah', 'wt').write('blah')
87
 
        self.assertEquals(self.capture('unknowns'), 'foo.blah\n')
88
 
        self.runbzr('ignore *.blah')
89
 
        self.assertEquals(self.capture('unknowns'), '')
 
87
        self.assertEquals(self.run_bzr(['unknowns'])[0], 'foo.blah\n')
 
88
        self.run_bzr('ignore *.blah')
 
89
        self.assertEquals(self.run_bzr(['unknowns'])[0], '')
90
90
        self.check_file_contents('.bzrignore', '*.blah\n')
91
91
 
92
92
        # 'ignore' works when then .bzrignore file already exists
93
93
        file('garh', 'wt').write('garh')
94
 
        self.assertEquals(self.capture('unknowns'), 'garh\n')
95
 
        self.runbzr('ignore garh')
96
 
        self.assertEquals(self.capture('unknowns'), '')
 
94
        self.assertEquals(self.run_bzr(['unknowns'])[0], 'garh\n')
 
95
        self.run_bzr('ignore garh')
 
96
        self.assertEquals(self.run_bzr(['unknowns'])[0], '')
97
97
        self.check_file_contents('.bzrignore', '*.blah\ngarh\n')
98
98
       
99
99
    def test_ignore_multiple_arguments(self):
100
100
        """'ignore' works with multiple arguments"""
101
 
        self.runbzr('init')
 
101
        self.run_bzr('init')
102
102
        self.build_tree(['a','b','c','d'])
103
 
        self.assertEquals(self.capture('unknowns'), 'a\nb\nc\nd\n')
104
 
        self.runbzr('ignore a b c')
105
 
        self.assertEquals(self.capture('unknowns'), 'd\n')
 
103
        self.assertEquals(self.run_bzr(['unknowns'])[0], 'a\nb\nc\nd\n')
 
104
        self.run_bzr('ignore a b c')
 
105
        self.assertEquals(self.run_bzr(['unknowns'])[0], 'd\n')
106
106
        self.check_file_contents('.bzrignore', 'a\nb\nc\n')
107
107
 
108
108
    def test_ignore_no_arguments(self):
109
109
        """'ignore' with no arguments returns an error"""
110
 
        self.runbzr('init')
 
110
        self.run_bzr('init')
111
111
        self.run_bzr_error(('bzr: ERROR: ignore requires at least one '
112
112
                            'NAME_PATTERN or --old-default-rules\n',),
113
113
                           'ignore')