~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-09-22 18:07:18 UTC
  • mfrom: (3363.13.6 extras)
  • Revision ID: pqm@pqm.ubuntu.com-20080922180718-n946121e40ql2bb3
Support PreviewTree.extras correctly (abentley)

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
216
218
        self.addCleanup(tree.unlock)
217
219
        self.assertTrue(tree.has_id('file-id'))
218
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()))