19
19
from bzrlib.branch import Branch
20
20
from bzrlib.selftest import TestCaseInTempDir
21
21
from bzrlib.trace import mutter
22
from bzrlib.workingtree import TreeEntry, TreeDirectory, TreeFile, TreeLink
22
from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
24
25
class TestTreeDirectory(TestCaseInTempDir):
57
58
self.assertEqual(files[0], ('dir', '?', 'directory', None, TreeDirectory()))
58
59
self.assertEqual(files[1], ('file', '?', 'file', None, TreeFile()))
59
60
self.assertEqual(files[2], ('symlink', '?', 'symlink', None, TreeLink()))
62
def test_construct_with_branch(self):
63
branch = Branch.initialize('.')
64
tree = WorkingTree(branch.base, branch)
65
self.assertEqual(branch, tree.branch)
66
self.assertEqual(branch.inventory, tree._inventory)
67
self.assertEqual(branch.base, tree.basedir)
69
def test_construct_without_branch(self):
70
branch = Branch.initialize('.')
71
tree = WorkingTree(branch.base)
72
self.assertEqual(branch.base, tree.branch.base)
73
self.assertEqual(branch.inventory, tree._inventory)
74
self.assertEqual(branch.base, tree.basedir)
76
def test_basic_relpath(self):
77
# for comprehensive relpath tests, see whitebox.py.
78
branch = Branch.initialize('.')
79
tree = WorkingTree(branch.base)
80
self.assertEqual('child',
81
tree.relpath(os.path.join(os.getcwd(), 'child')))