~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_add.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-07-19 21:44:16 UTC
  • mfrom: (1836.1.26 ignores)
  • Revision ID: pqm@pqm.ubuntu.com-20060719214416-9fab2f627df9f1aa
(jam) allow global user ignores, and include a small set by default

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import os
2
2
import unittest
3
3
 
4
 
from bzrlib import errors, osutils
 
4
from bzrlib import errors, ignores, osutils
5
5
from bzrlib.add import smart_add, smart_add_tree
6
6
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
7
7
from bzrlib.errors import NoSuchFile
99
99
    def test_add_dry_run(self):
100
100
        """Test a dry run add, make sure nothing is added."""
101
101
        from bzrlib.commands import run_bzr
 
102
        ignores.set_user_ignores(['./.bazaar'])
102
103
        eq = self.assertEqual
103
104
        wt = self.make_branch_and_tree('.')
104
105
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
116
117
        """Correctly returns added/ignored files"""
117
118
        from bzrlib.commands import run_bzr
118
119
        wt = self.make_branch_and_tree('.')
119
 
        # no files should be ignored by default, so we need to create
120
 
        # an ignore rule - we create one for the pyc files, which means
121
 
        # CVS should not be ignored.
122
 
        self.build_tree(['inertiatic/', 'inertiatic/esp', 'inertiatic/CVS', 
 
120
        # The default ignore list includes '*.py[co]', but not CVS
 
121
        ignores.set_user_ignores(['./.bazaar', '*.py[co]'])
 
122
        self.build_tree(['inertiatic/', 'inertiatic/esp', 'inertiatic/CVS',
123
123
                        'inertiatic/foo.pyc'])
124
 
        self.build_tree_contents([('.bzrignore', '*.py[oc]\n')])
125
124
        added, ignored = smart_add_tree(wt, u'.')
126
125
        self.assertSubset(('inertiatic', 'inertiatic/esp', 'inertiatic/CVS'),
127
126
                          added)
128
 
        self.assertSubset(('*.py[oc]',), ignored)
129
 
        self.assertSubset(('inertiatic/foo.pyc',), ignored['*.py[oc]'])
 
127
        self.assertSubset(('*.py[co]',), ignored)
 
128
        self.assertSubset(('inertiatic/foo.pyc',), ignored['*.py[co]'])
130
129
 
131
130
 
132
131
class TestSmartAddTree(TestCaseWithTransport):