~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/tree_implementations/test_tree.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from bzrlib import (
18
18
    errors,
 
19
    conflicts,
 
20
    revisiontree,
19
21
    tests,
20
 
    conflicts,
 
22
    workingtree_4,
21
23
    )
22
24
from bzrlib.tests import TestSkipped
23
25
from bzrlib.tests.tree_implementations import TestCaseWithTree
203
205
        output_order = [p for p, e in tree.iter_entries_by_dir()]
204
206
        self.assertEqual(['', 'a', 'f', 'a/b', 'a/d', 'a/b/c', 'a/d/e', 'f/g'],
205
207
                         output_order)
 
208
 
 
209
 
 
210
class TestHasId(TestCaseWithTree):
 
211
 
 
212
    def test_has_id(self):
 
213
        work_tree = self.make_branch_and_tree('tree')
 
214
        self.build_tree(['tree/file'])
 
215
        work_tree.add('file', 'file-id')
 
216
        tree = self._convert_tree(work_tree)
 
217
        tree.lock_read()
 
218
        self.addCleanup(tree.unlock)
 
219
        self.assertTrue(tree.has_id('file-id'))
 
220
        self.assertFalse(tree.has_id('dir-id'))
 
221
 
 
222
 
 
223
class TestExtras(TestCaseWithTree):
 
224
 
 
225
    def test_extras(self):
 
226
        work_tree = self.make_branch_and_tree('tree')
 
227
        self.build_tree(['tree/file', 'tree/versioned-file'])
 
228
        work_tree.add(['file', 'versioned-file'])
 
229
        work_tree.commit('add files')
 
230
        work_tree.remove('file')
 
231
        tree = self._convert_tree(work_tree)
 
232
        if isinstance(tree,
 
233
                      (revisiontree.RevisionTree,
 
234
                       workingtree_4.DirStateRevisionTree)):
 
235
            expected = []
 
236
        else:
 
237
            expected = ['file']
 
238
        tree.lock_read()
 
239
        self.addCleanup(tree.unlock)
 
240
        self.assertEqual(expected, list(tree.extras()))