27
27
from bzrlib.deprecated_graph import Graph
28
28
from bzrlib.revision import (find_present_ancestors, combined_graph,
30
is_ancestor, MultipleRevisionSources,
30
MultipleRevisionSources,
32
from bzrlib.symbol_versioning import one_zero, one_three
32
from bzrlib.symbol_versioning import one_three
33
33
from bzrlib.tests import TestCase, TestCaseWithTransport
34
34
from bzrlib.trace import mutter
35
35
from bzrlib.workingtree import WorkingTree
127
127
self.assertEquals(result, [None] + sorted(anc))
130
def test_is_ancestor(self):
131
"""Test checking whether a revision is an ancestor of another revision"""
132
br1, br2 = make_branches(self)
133
revisions = br1.revision_history()
134
revisions_2 = br2.revision_history()
139
self.addCleanup(br1.unlock)
141
self.addCleanup(br2.unlock)
143
self.assertTrue(self.applyDeprecated(one_zero,
144
is_ancestor, revisions[0], revisions[0], br1))
145
self.assertTrue(self.applyDeprecated(one_zero,
146
is_ancestor, revisions[1], revisions[0], sources))
147
self.assertFalse(self.applyDeprecated(one_zero,
148
is_ancestor, revisions[0], revisions[1], sources))
149
self.assertTrue(self.applyDeprecated(one_zero,
150
is_ancestor, revisions_2[3], revisions[0], sources))
151
# disabled mbp 20050914, doesn't seem to happen anymore
152
## self.assertRaises(NoSuchRevision, is_ancestor, revisions_2[3],
153
## revisions[0], br1)
154
self.assertTrue(self.applyDeprecated(one_zero,
155
is_ancestor, revisions[3], revisions_2[4], sources))
156
self.assertTrue(self.applyDeprecated(one_zero,
157
is_ancestor, revisions[3], revisions_2[4], br1))
158
self.assertTrue(self.applyDeprecated(one_zero,
159
is_ancestor, revisions[3], revisions_2[3], sources))
160
## self.assert_(not is_ancestor(revisions[3], revisions_2[3], br1))
163
130
class TestIntermediateRevisions(TestCaseWithTransport):