~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Kent Gibson
  • Date: 2006-10-14 10:28:50 UTC
  • mto: (2104.1.2 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2105.
  • Revision ID: warthog618@gmail.com-20061014102850-16fdc0e05ccad845
Strip trailing slashes from ignore patterns (#4559).
Complain about absolute paths in ignore patterns.

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
        self.runbzr('ignore a b c')
85
85
        self.assertEquals(self.capture('unknowns'), 'd\n')
86
86
        self.check_file_contents('.bzrignore', 'a\nb\nc\n')
 
87
 
 
88
    def test_ignore_no_arguments(self):
 
89
        """'ignore' with no arguments returns an error"""
 
90
        self.runbzr('init')
 
91
        self.run_bzr_error(('bzr: ERROR: ignore requires at least one '
 
92
                            'NAME_PATTERN or --old-default-rules\n',), 
 
93
                           'ignore')
 
94
 
 
95
    def test_ignore_absolutes(self):
 
96
        """'ignore' with an absolute path returns an error"""
 
97
        self.runbzr('init')
 
98
        self.run_bzr_error(('bzr: ERROR: NAME_PATTERN should not '
 
99
                            'be an absolute path\n',),
 
100
                           'ignore','/crud')
87
101
        
88
102
    def test_ignore_old_defaults(self):
89
103
        out, err = self.run_bzr('ignore', '--old-default-rules')
90
104
        self.assertContainsRe(out, 'CVS')
91
105
        self.assertEqual('', err)
 
106
 
 
107
    def test_ignore_directories(self):
 
108
        """ignoring a directory should ignore directory tree.
 
109
 
 
110
        Also check that trailing slashes on directories are stripped.
 
111
        """
 
112
        self.runbzr('init')
 
113
        self.build_tree(['dir1/', 'dir1/foo', 
 
114
                         'dir2/', 'dir2/bar', 
 
115
                         'dir3/', 'dir3/baz'])
 
116
        self.runbzr('ignore dir1 dir2/')
 
117
        self.check_file_contents('.bzrignore', 'dir1\ndir2\n')
 
118
        self.assertEquals(self.capture('unknowns'), 'dir3\n')
 
119