48
48
so A is missing b6 at the start
49
49
and B is missing a3, a4, a5
52
br1 = Branch.initialize("branch1")
51
tree1 = self.make_branch_and_tree("branch1")
54
commit(br1, "Commit one", rev_id="a@u-0-0")
55
commit(br1, "Commit two", rev_id="a@u-0-1")
56
commit(br1, "Commit three", rev_id="a@u-0-2")
54
tree1.commit("Commit one", rev_id="a@u-0-0")
55
tree1.commit("Commit two", rev_id="a@u-0-1")
56
tree1.commit("Commit three", rev_id="a@u-0-2")
59
br2 = Branch.initialize("branch2")
58
tree2 = self.make_branch_and_tree("branch2")
60
60
br2.update_revisions(br1)
61
commit(br2, "Commit four", rev_id="b@u-0-3")
62
commit(br2, "Commit five", rev_id="b@u-0-4")
61
tree2.commit("Commit four", rev_id="b@u-0-3")
62
tree2.commit("Commit five", rev_id="b@u-0-4")
63
63
revisions_2 = br2.revision_history()
65
65
fetch(from_branch=br2, to_branch=br1)
66
br1.working_tree().add_pending_merge(revisions_2[4])
66
tree1.add_pending_merge(revisions_2[4])
67
67
self.assertEquals(revisions_2[4], 'b@u-0-4')
68
commit(br1, "Commit six", rev_id="a@u-0-3")
69
commit(br1, "Commit seven", rev_id="a@u-0-4")
70
commit(br2, "Commit eight", rev_id="b@u-0-5")
68
tree1.commit("Commit six", rev_id="a@u-0-3")
69
tree1.commit("Commit seven", rev_id="a@u-0-4")
70
tree2.commit("Commit eight", rev_id="b@u-0-5")
72
72
fetch(from_branch=br2, to_branch=br1)
73
br1.working_tree().add_pending_merge(br2.revision_history()[5])
74
commit(br1, "Commit nine", rev_id="a@u-0-5")
73
tree1.add_pending_merge(br2.revision_history()[5])
74
tree1.commit("Commit nine", rev_id="a@u-0-5")
75
75
# DO NOT FETCH HERE - we WANT a GHOST.
76
76
#fetch(from_branch=br1, to_branch=br2)
77
br2.working_tree().add_pending_merge(br1.revision_history()[4])
78
commit(br2, "Commit ten - ghost merge", rev_id="b@u-0-6")
77
tree2.add_pending_merge(br1.revision_history()[4])
78
tree2.commit("Commit ten - ghost merge", rev_id="b@u-0-6")
83
class TestIsAncestor(TestCaseInTempDir):
83
class TestIsAncestor(TestCaseWithTransport):
84
85
def test_recorded_ancestry(self):
85
86
"""Test that commit records all ancestors"""
86
87
br1, br2 = make_branches(self)
112
113
if rev_id in br2_only and not branch is br2:
114
115
mutter('ancestry of {%s}: %r',
115
rev_id, branch.get_ancestry(rev_id))
116
self.assertEquals(sorted(branch.get_ancestry(rev_id)),
117
[None] + sorted(anc))
116
rev_id, branch.repository.get_ancestry(rev_id))
117
result = sorted(branch.repository.get_ancestry(rev_id))
118
self.assertEquals(result, [None] + sorted(anc))
120
121
def test_is_ancestor(self):
137
138
## self.assert_(not is_ancestor(revisions[3], revisions_2[3], br1))
140
class TestIntermediateRevisions(TestCaseInTempDir):
141
class TestIntermediateRevisions(TestCaseWithTransport):
143
144
from bzrlib.commit import commit
144
TestCaseInTempDir.setUp(self)
145
TestCaseWithTransport.setUp(self)
145
146
self.br1, self.br2 = make_branches(self)
147
148
self.br2.working_tree().commit("Commit eleven", rev_id="b@u-0-7")
157
158
self.br2.working_tree().commit("Commit fifteen", rev_id="b@u-0-10")
159
160
from bzrlib.revision import MultipleRevisionSources
160
self.sources = MultipleRevisionSources(self.br1, self.br2)
161
self.sources = MultipleRevisionSources(self.br1.repository,
162
164
def intervene(self, ancestor, revision, revision_history=None):
163
165
from bzrlib.revision import get_intervening_revisions
288
290
Ensure it's not order-sensitive
290
292
br1, br2 = make_branches(self)
291
source = MultipleRevisionSources(br1, br2)
293
source = MultipleRevisionSources(br1.repository, br2.repository)
292
294
combined_1 = combined_graph(br1.last_revision(),
293
295
br2.last_revision(), source)
294
296
combined_2 = combined_graph(br2.last_revision(),