30
30
UninitializableFormat,
33
from bzrlib.inventory import Inventory
33
from bzrlib.inventory import Inventory, InventoryDirectory
34
34
from bzrlib.revision import NULL_REVISION
35
35
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
36
36
from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
154
154
def test_revision_tree(self):
155
155
wt = self.make_branch_and_tree('.')
156
wt.set_root_id('fixed-root')
156
157
wt.commit('lala!', rev_id='revision-1', allow_pointless=True)
157
158
tree = wt.branch.repository.revision_tree('revision-1')
158
self.assertEqual(list(tree.list_files()), [])
159
self.assertEqual('revision-1', tree.inventory.root.revision)
160
expected = InventoryDirectory('fixed-root', '', None)
161
expected.revision = 'revision-1'
162
self.assertEqual([('', 'V', 'directory', 'fixed-root', expected)],
163
list(tree.list_files(include_root=True)))
159
164
tree = wt.branch.repository.revision_tree(None)
160
self.assertEqual([], list(tree.list_files()))
165
self.assertEqual([], list(tree.list_files(include_root=True)))
161
166
tree = wt.branch.repository.revision_tree(NULL_REVISION)
162
self.assertEqual([], list(tree.list_files()))
167
self.assertEqual([], list(tree.list_files(include_root=True)))
164
169
def test_fetch(self):
165
170
# smoke test fetch to ensure that the convenience function works.
582
587
FOO_ID = 'foo<:>ID'
583
588
REV_ID = 'revid-1'
584
589
wt = self.make_branch_and_tree('repo')
585
self.build_tree(["repo/foo"])
590
self.build_tree(["repo/foo"], line_endings='binary')
586
591
# add file with id containing wierd characters
587
592
wt.add(['foo'], [FOO_ID])
588
593
wt.commit('this is my new commit', rev_id=REV_ID)