34
34
return tree.iter_entries_by_dir([file_id]).next()[1]
37
class TestPreviousHeads(per_tree.TestCaseWithTree):
40
# we want several inventories, that respectively
41
# give use the following scenarios:
42
# A) fileid not in any inventory (A),
43
# B) fileid present in one inventory (B) and (A,B)
44
# C) fileid present in two inventories, and they
45
# are not mutual descendents (B, C)
46
# D) fileid present in two inventories and one is
47
# a descendent of the other. (B, D)
48
super(TestPreviousHeads, self).setUp()
49
self.wt = self.make_branch_and_tree('.')
50
self.branch = self.wt.branch
51
self.build_tree(['file'])
52
self.wt.commit('new branch', allow_pointless=True, rev_id='A')
53
self.inv_A = self.branch.repository.get_inventory('A')
54
self.wt.add(['file'], ['fileid'])
55
self.wt.commit('add file', rev_id='B')
56
self.inv_B = self.branch.repository.get_inventory('B')
57
uncommit(self.branch, tree=self.wt)
58
self.assertEqual(self.branch.revision_history(), ['A'])
59
self.wt.commit('another add of file', rev_id='C')
60
self.inv_C = self.branch.repository.get_inventory('C')
61
self.wt.add_parent_tree_id('B')
62
self.wt.commit('merge in B', rev_id='D')
63
self.inv_D = self.branch.repository.get_inventory('D')
64
self.tree = self.workingtree_to_test_tree(self.wt)
66
self.addCleanup(self.tree.unlock)
67
self.file_active = get_entry(self.tree, 'fileid')
69
# TODO: test two inventories with the same file revision
72
37
class TestInventoryWithSymlinks(per_tree.TestCaseWithTree):
74
39
_test_needs_features = [tests.SymlinkFeature]