~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_add.py

 * bzr add now lists how many files were ignored per glob.  add --verbose
   lists the specific files.  (Aaron Bentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
from bzrlib.errors import NotBranchError, NoSuchFile
7
7
from bzrlib.inventory import InventoryFile, Inventory
8
8
from bzrlib.workingtree import WorkingTree
 
9
from bzrlib.add import smart_add
9
10
 
10
11
class TestSmartAdd(TestCaseInTempDir):
11
12
 
91
92
        branch = Branch.initialize(u".")
92
93
        self.assertRaises(NoSuchFile, smart_add, 'non-existant-file')
93
94
 
 
95
    def test_returns(self):
 
96
        """Correctly returns added/ignored files"""
 
97
        from bzrlib.commands import run_bzr
 
98
        b = Branch.initialize(u'.')
 
99
        t = b.working_tree()
 
100
        self.build_tree(['inertiatic/', 'inertiatic/esp', 'inertiatic/CVS', 
 
101
                        'inertiatic/foo.pyc'])
 
102
        added, ignored = smart_add(u'.')
 
103
        self.AssertSubset(('inertiatic', 'inertiatic/esp'), added)
 
104
        self.AssertSubset(('CVS', '*.py[oc]'), ignored)
 
105
        self.AssertSubset(('inertiatic/CVS',), ignored['CVS'])
 
106
        self.AssertSubset(('inertiatic/foo.pyc',), ignored['*.py[oc]'])
 
107
 
94
108
 
95
109
class TestSmartAddBranch(TestCaseInTempDir):
96
110
    """Test smart adds with a specified branch."""
164
178
        for path in paths:
165
179
            self.assertNotEqual(tree.path2id(path), None)
166
180
 
 
181
 
167
182
class TestAddActions(TestCaseInTempDir):
168
183
 
169
184
    def test_null(self):