58
56
assert len(br_b.revision_history()) == 7
59
57
assert greedy_fetch(br_b, br_a, br_a.revision_history()[3])[0] == 1
60
58
assert has_revision(br_b, br_a.revision_history()[3])
61
assert not has_revision(br_a, br_b.revision_history()[3])
62
assert not has_revision(br_a, br_b.revision_history()[4])
59
assert not has_revision(br_a, br_b.revision_history()[6])
60
assert has_revision(br_a, br_b.revision_history()[5])
64
62
# When a non-branch ancestor is missing, it should be a failure, not
66
br_a4 = new_branch('br_a4')
67
count, failures = greedy_fetch(br_a4, br_a)
69
assert failures == set((br_b.revision_history()[4],
70
br_b.revision_history()[5]))
64
print ("CANNOT TEST MISSING NON REVISION_HISTORY ANCESTORS WITHOUT"
66
# br_a4 = new_branch('br_a4')
67
# count, failures = greedy_fetch(br_a4, br_a)
68
# self.assertEqual(count, 6)
69
# self.assertEqual(failures, set((br_b.revision_history()[4],
70
# br_b.revision_history()[5])))
72
assert greedy_fetch(br_a, br_b)[0] == 4
72
self.assertEqual(greedy_fetch(br_a, br_b)[0], 1)
73
73
assert has_revision(br_a, br_b.revision_history()[3])
74
74
assert has_revision(br_a, br_b.revision_history()[4])
83
83
assert greedy_fetch(br_a2, br_a)[0] == 9
84
84
assert has_revision(br_a2, br_b.revision_history()[4])
85
85
assert has_revision(br_a2, br_a.revision_history()[3])
86
assert has_revision(br_a2, br_a.revision_history()[2])
87
88
br_a3 = new_branch('br_a3')
88
89
assert greedy_fetch(br_a3, br_a2)[0] == 0
89
90
for revno in range(4):
90
91
assert not has_revision(br_a3, br_a.revision_history()[revno])
91
assert greedy_fetch(br_a3, br_a2, br_a.revision_history()[2])[0] == 3
92
self.assertEqual(greedy_fetch(br_a3, br_a2, br_a.revision_history()[2])[0], 3)
92
93
fetched = greedy_fetch(br_a3, br_a2, br_a.revision_history()[3])[0]
93
94
assert fetched == 3, "fetched %d instead of 3" % fetched
94
95
# InstallFailed should be raised if the branch is missing the revision
100
101
br_a2.append_revision('a-b-c')
101
102
self.assertRaises(bzrlib.errors.InstallFailed, greedy_fetch, br_a3,
106
if __name__ == '__main__':