4
4
from bzrlib import errors, osutils
5
5
from bzrlib.add import smart_add, smart_add_tree
6
6
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
7
from bzrlib.errors import NotBranchError, NoSuchFile
7
from bzrlib.errors import NoSuchFile
8
8
from bzrlib.inventory import InventoryFile, Inventory
9
9
from bzrlib.workingtree import WorkingTree
112
112
wt = self.make_branch_and_tree('.')
113
113
self.assertRaises(NoSuchFile, smart_add_tree, wt, 'non-existant-file')
115
def test_returns(self):
115
def test_returns_and_ignores(self):
116
116
"""Correctly returns added/ignored files"""
117
117
from bzrlib.commands import run_bzr
118
118
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.
119
122
self.build_tree(['inertiatic/', 'inertiatic/esp', 'inertiatic/CVS',
120
123
'inertiatic/foo.pyc'])
124
self.build_tree_contents([('.bzrignore', '*.py[oc]\n')])
121
125
added, ignored = smart_add_tree(wt, u'.')
122
self.assertSubset(('inertiatic', 'inertiatic/esp'), added)
123
self.assertSubset(('CVS', '*.py[oc]'), ignored)
124
self.assertSubset(('inertiatic/CVS',), ignored['CVS'])
126
self.assertSubset(('inertiatic', 'inertiatic/esp', 'inertiatic/CVS'),
128
self.assertSubset(('*.py[oc]',), ignored)
125
129
self.assertSubset(('inertiatic/foo.pyc',), ignored['*.py[oc]'])
128
class TestSmartAddBranch(TestCaseWithTransport):
132
class TestSmartAddTree(TestCaseWithTransport):
129
133
"""Test smart adds with a specified branch."""
131
135
def test_add_dot_from_root(self):