89
89
return Branch(name, init=True)
91
#highest indices a: 3, b: 4
91
#highest indices a: 5, b: 7
92
92
br_a, br_b = make_branches()
93
93
assert not has_revision(br_b, br_a.revision_history()[3])
94
94
assert has_revision(br_b, br_a.revision_history()[2])
95
assert len(br_b.revision_history()) == 5
95
assert len(br_b.revision_history()) == 7
96
96
assert greedy_fetch(br_b, br_a, br_a.revision_history()[2])[0] == 0
98
98
# greedy_fetch is not supposed to alter the revision history
99
assert len(br_b.revision_history()) == 5
99
assert len(br_b.revision_history()) == 7
100
100
assert not has_revision(br_b, br_a.revision_history()[3])
102
assert len(br_b.revision_history()) == 5
102
assert len(br_b.revision_history()) == 7
103
103
assert greedy_fetch(br_b, br_a, br_a.revision_history()[3])[0] == 1
104
104
assert has_revision(br_b, br_a.revision_history()[3])
105
105
assert not has_revision(br_a, br_b.revision_history()[3])
110
110
br_a4 = new_branch('br_a4')
111
111
count, failures = greedy_fetch(br_a4, br_a)
113
assert failures == set((br_b.revision_history()[4],))
113
assert failures == set((br_b.revision_history()[4],
114
br_b.revision_history()[5]))
115
assert greedy_fetch(br_a, br_b)[0] == 2
116
assert greedy_fetch(br_a, br_b)[0] == 4
116
117
assert has_revision(br_a, br_b.revision_history()[3])
117
118
assert has_revision(br_a, br_b.revision_history()[4])
119
120
br_b2 = new_branch('br_b2')
120
assert greedy_fetch(br_b2, br_b)[0] == 5
121
assert greedy_fetch(br_b2, br_b)[0] == 7
121
122
assert has_revision(br_b2, br_b.revision_history()[4])
122
123
assert has_revision(br_b2, br_a.revision_history()[2])
123
124
assert not has_revision(br_b2, br_a.revision_history()[3])
125
126
br_a2 = new_branch('br_a2')
126
assert greedy_fetch(br_a2, br_a)[0] == 6
127
assert greedy_fetch(br_a2, br_a)[0] == 9
127
128
assert has_revision(br_a2, br_b.revision_history()[4])
128
129
assert has_revision(br_a2, br_a.revision_history()[3])