20
from bzrlib.tests import TestCaseWithTransport
21
20
from bzrlib.branch import Branch
21
from bzrlib.errors import NoSuchRevision
22
22
from bzrlib.commit import commit
23
23
from bzrlib.fetch import fetch
24
24
from bzrlib.revision import (find_present_ancestors, combined_graph,
25
25
is_ancestor, MultipleRevisionSources)
26
from bzrlib.tests import TestCaseWithTransport
26
27
from bzrlib.trace import mutter
27
from bzrlib.errors import NoSuchRevision
28
from bzrlib.workingtree import WorkingTree
29
30
# XXX: Make this a method of a merge base case
30
31
def make_branches(self):
144
145
from bzrlib.commit import commit
145
146
TestCaseWithTransport.setUp(self)
146
147
self.br1, self.br2 = make_branches(self)
148
self.br2.working_tree().commit("Commit eleven", rev_id="b@u-0-7")
149
self.br2.working_tree().commit("Commit twelve", rev_id="b@u-0-8")
150
self.br2.working_tree().commit("Commit thirtteen", rev_id="b@u-0-9")
148
wt1 = self.br1.bzrdir.open_workingtree()
149
wt2 = self.br2.bzrdir.open_workingtree()
150
wt2.commit("Commit eleven", rev_id="b@u-0-7")
151
wt2.commit("Commit twelve", rev_id="b@u-0-8")
152
wt2.commit("Commit thirtteen", rev_id="b@u-0-9")
152
154
fetch(from_branch=self.br2, to_branch=self.br1)
153
self.br1.working_tree().add_pending_merge(self.br2.revision_history()[6])
154
self.br1.working_tree().commit("Commit fourtten", rev_id="a@u-0-6")
155
wt1.add_pending_merge(self.br2.revision_history()[6])
156
wt1.commit("Commit fourtten", rev_id="a@u-0-6")
156
158
fetch(from_branch=self.br1, to_branch=self.br2)
157
self.br2.working_tree().add_pending_merge(self.br1.revision_history()[6])
158
self.br2.working_tree().commit("Commit fifteen", rev_id="b@u-0-10")
159
wt2.add_pending_merge(self.br1.revision_history()[6])
160
wt2.commit("Commit fifteen", rev_id="b@u-0-10")
160
162
from bzrlib.revision import MultipleRevisionSources
161
163
self.sources = MultipleRevisionSources(self.br1.repository,
299
301
self.assertEquals(combined_1[2], combined_2[2])
300
302
self.assertEquals(combined_1[3], combined_2[3])
301
303
self.assertEquals(combined_1, combined_2)
305
def test_get_history(self):
306
# TODO: test ghosts on the left hand branch's impact
307
# TODO: test ghosts on all parents, we should get some
308
# indicator. i.e. NULL_REVISION
310
tree = self.make_branch_and_tree('.')
311
tree.commit('1', rev_id = '1', allow_pointless=True)
312
tree.commit('2', rev_id = '2', allow_pointless=True)
313
tree.commit('3', rev_id = '3', allow_pointless=True)
314
rev = tree.branch.repository.get_revision('1')
315
history = rev.get_history(tree.branch.repository)
316
self.assertEqual([None, '1'], history)
317
rev = tree.branch.repository.get_revision('2')
318
history = rev.get_history(tree.branch.repository)
319
self.assertEqual([None, '1', '2'], history)
320
rev = tree.branch.repository.get_revision('3')
321
history = rev.get_history(tree.branch.repository)
322
self.assertEqual([None, '1', '2' ,'3'], history)