36
34
def test_straightline_ancestry(self):
37
35
"""Test ancestry file when just committing."""
38
builder = BranchBuilder(self.get_transport())
39
rev_id_one = builder.build_commit()
40
rev_id_two = builder.build_commit()
41
branch = builder.get_branch()
36
tree = self.make_branch_and_memory_tree('.')
38
rev_id_one = tree.commit('one')
39
rev_id_two = tree.commit('two', allow_pointless=True)
42
41
self.assertAncestryEqual([None, rev_id_one, rev_id_two],
43
42
rev_id_two, branch)
44
43
self.assertAncestryEqual([None, rev_id_one], rev_id_one, branch)
46
def test_none_is_ancestor_empty_branch(self):
47
branch = self.make_branch('.')
48
self.assertTrue(self.applyDeprecated(one_zero,
49
is_ancestor, 'null:', 'null:', branch))
51
def test_none_is_ancestor_non_empty_branch(self):
52
builder = BranchBuilder(self.get_transport())
53
rev_id = builder.build_commit()
54
branch = builder.get_branch()
56
self.addCleanup(branch.unlock)
57
self.assertTrue(self.applyDeprecated(one_zero,
58
is_ancestor, 'null:', 'null:', branch))
59
self.assertTrue(self.applyDeprecated(one_zero,
60
is_ancestor, rev_id, 'null:', branch))
61
self.assertFalse(self.applyDeprecated(one_zero,
62
is_ancestor, 'null:', rev_id, branch))
45
def test_none_is_always_an_ancestor(self):
46
tree = self.make_branch_and_memory_tree('.')
47
# note this is tested before any commits are done.
48
self.assertTrue(is_ancestor(None, None, tree.branch))
49
rev_id = tree.commit('one')
50
self.assertTrue(is_ancestor(None, None, tree.branch))
51
self.assertTrue(is_ancestor(rev_id, None, tree.branch))
52
self.assertFalse(is_ancestor(None, rev_id, tree.branch))
65
55
# TODO: check that ancestry is updated to include indirectly merged revisions