/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Martin von Gagern
  • Date: 2010-04-20 08:47:38 UTC
  • mfrom: (5167 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5195.
  • Revision ID: martin.vgagern@gmx.net-20100420084738-ygymnqmdllzrhpfn
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009, 2010 Canonical Ltd
2
2
# Authors:  Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
13
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
import bzrlib
19
19
from bzrlib import config, ignores, osutils
20
 
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 
20
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
21
21
 
22
22
 
23
23
class TestIsIgnored(TestCaseWithWorkingTree):
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(''))