~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2008-09-02 05:28:37 UTC
  • mfrom: (3675 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3677.
  • Revision ID: robertc@robertcollins.net-20080902052837-ec3qlv41q5e7f6fl
Resolve conflicts with NEWS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for the generic Tree.walkdirs interface."""
18
18
 
 
19
import os
 
20
 
 
21
from bzrlib import tests
19
22
from bzrlib.osutils import has_symlinks
20
23
from bzrlib.tests.tree_implementations import TestCaseWithTree
21
24
 
98
101
        for pos, item in enumerate(expected_dirblocks):
99
102
            self.assertEqual(item, result[pos])
100
103
        self.assertEqual(len(expected_dirblocks), len(result))
 
104
 
 
105
    def test_walkdir_versioned_kind(self):
 
106
        work_tree = self.make_branch_and_tree('tree')
 
107
        work_tree.set_root_id('tree-root')
 
108
        self.build_tree(['tree/file', 'tree/dir/'])
 
109
        work_tree.add(['file', 'dir'], ['file-id', 'dir-id'])
 
110
        os.unlink('tree/file')
 
111
        os.rmdir('tree/dir')
 
112
        tree = self._convert_tree(work_tree)
 
113
        tree.lock_read()
 
114
        self.addCleanup(tree.unlock)
 
115
        if tree.path2id('file') is None:
 
116
            raise tests.TestNotApplicable(
 
117
                'Tree type cannot represent dangling ids.')
 
118
        expected = [(('', 'tree-root'), [
 
119
            ('dir', 'dir', 'unknown', None, 'dir-id', 'directory'),
 
120
            ('file', 'file', 'unknown', None, 'file-id', 'file')]),
 
121
            (('dir', 'dir-id'), [])]
 
122
        self.assertEqual(expected, list(tree.walkdirs()))