~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_is_ignored.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-01-21 17:54:58 UTC
  • mfrom: (4948.5.7 ignore-exclusion)
  • Revision ID: pqm@pqm.ubuntu.com-20100121175458-17l0cvckbrf93eea
(John Whitley) implement ! and !! to exclude files from ignore rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
            ('.bzrignore', './rootdir\n'
32
32
                           'randomfile*\n'
33
33
                           '*bar\n'
 
34
                           '!bazbar\n'
34
35
                           '?foo\n'
35
36
                           '*.~*\n'
36
37
                           'dir1/*f1\n'
37
38
                           'dir1/?f2\n'
 
39
                           'RE:dir2/.*\.wombat\n'
38
40
                           'path/from/ro?t\n'
 
41
                           '**/piffle.py\n'
 
42
                           '!b/piffle.py\n'
39
43
                           'unicode\xc2\xb5\n' # u'\xb5'.encode('utf8')
40
44
                           'dos\r\n'
41
45
                           '\n' # empty line
58
62
        self.assertEqual("path/from/ro?t", tree.is_ignored('path/from/root'))
59
63
        self.assertEqual("path/from/ro?t", tree.is_ignored('path/from/roat'))
60
64
        self.assertEqual(None, tree.is_ignored('roat'))
 
65
        
 
66
        self.assertEqual('**/piffle.py', tree.is_ignored('piffle.py'))
 
67
        self.assertEqual('**/piffle.py', tree.is_ignored('a/piffle.py'))
 
68
        self.assertEqual(None, tree.is_ignored('b/piffle.py')) # exclusion
 
69
        self.assertEqual('**/piffle.py', tree.is_ignored('foo/bar/piffle.py'))
 
70
        self.assertEqual(None, tree.is_ignored('p/iffle.py'))
61
71
 
62
72
        self.assertEqual(u'unicode\xb5', tree.is_ignored(u'unicode\xb5'))
63
73
        self.assertEqual(u'unicode\xb5', tree.is_ignored(u'subdir/unicode\xb5'))
72
82
        self.assertEqual('*bar', tree.is_ignored(r'foo\nbar'))
73
83
        self.assertEqual('*bar', tree.is_ignored('bar'))
74
84
        self.assertEqual('*bar', tree.is_ignored('.bar'))
 
85
        
 
86
        self.assertEqual(None, tree.is_ignored('bazbar')) # exclusion
75
87
 
76
88
        self.assertEqual('?foo', tree.is_ignored('afoo'))
77
89
        self.assertEqual('?foo', tree.is_ignored('.foo'))
84
96
 
85
97
        self.assertEqual('dir1/?f2', tree.is_ignored('dir1/ff2'))
86
98
        self.assertEqual('dir1/?f2', tree.is_ignored('dir1/.f2'))
 
99
        
 
100
        self.assertEqual('RE:dir2/.*\.wombat', tree.is_ignored('dir2/foo.wombat'))
 
101
        self.assertEqual(None, tree.is_ignored('dir2/foo'))
87
102
 
88
103
        # Blank lines and comments should be ignored
89
104
        self.assertEqual(None, tree.is_ignored(''))