43
43
return Branch.initialize(name)
45
assert not has_revision(br_b, br_a.revision_history()[3])
46
assert has_revision(br_b, br_a.revision_history()[2])
47
assert len(br_b.revision_history()) == 7
48
assert greedy_fetch(br_b, br_a, br_a.revision_history()[2])[0] == 0
45
self.assertFalse(has_revision(br_b, br_a.revision_history()[3]))
46
self.assert_(has_revision(br_b, br_a.revision_history()[2]))
47
self.assertEquals(len(br_b.revision_history()), 7)
48
self.assertEquals(greedy_fetch(br_b, br_a, br_a.revision_history()[2])[0], 0)
50
50
# greedy_fetch is not supposed to alter the revision history
51
assert len(br_b.revision_history()) == 7
52
assert not has_revision(br_b, br_a.revision_history()[3])
51
self.assertEquals(len(br_b.revision_history()), 7)
52
self.assertFalse(has_revision(br_b, br_a.revision_history()[3]))
54
assert len(br_b.revision_history()) == 7
55
assert greedy_fetch(br_b, br_a, br_a.revision_history()[3])[0] == 1
56
assert has_revision(br_b, br_a.revision_history()[3])
57
assert not has_revision(br_a, br_b.revision_history()[6])
58
assert has_revision(br_a, br_b.revision_history()[5])
54
self.assertEquals(len(br_b.revision_history()), 7)
55
self.assertEquals(greedy_fetch(br_b, br_a, br_a.revision_history()[3])[0], 1)
56
self.assert_(has_revision(br_b, br_a.revision_history()[3]))
57
self.assertFalse(has_revision(br_a, br_b.revision_history()[6]))
58
self.assert_(has_revision(br_a, br_b.revision_history()[5]))
60
60
# When a non-branch ancestor is missing, it should be unlisted...
61
61
# as its not reference from the inventory weave.
65
65
self.assertEqual(failures, [])
67
67
self.assertEqual(greedy_fetch(writable_a, br_b)[0], 1)
68
assert has_revision(br_a, br_b.revision_history()[3])
69
assert has_revision(br_a, br_b.revision_history()[4])
68
self.assert_(has_revision(br_a, br_b.revision_history()[3]))
69
self.assert_(has_revision(br_a, br_b.revision_history()[4]))
71
71
br_b2 = new_branch('br_b2')
72
assert greedy_fetch(br_b2, br_b)[0] == 7
73
assert has_revision(br_b2, br_b.revision_history()[4])
74
assert has_revision(br_b2, br_a.revision_history()[2])
75
assert not has_revision(br_b2, br_a.revision_history()[3])
72
self.assertEquals(greedy_fetch(br_b2, br_b)[0], 7)
73
self.assert_(has_revision(br_b2, br_b.revision_history()[4]))
74
self.assert_(has_revision(br_b2, br_a.revision_history()[2]))
75
self.assertFalse(has_revision(br_b2, br_a.revision_history()[3]))
77
77
br_a2 = new_branch('br_a2')
78
assert greedy_fetch(br_a2, br_a)[0] == 9
79
assert has_revision(br_a2, br_b.revision_history()[4])
80
assert has_revision(br_a2, br_a.revision_history()[3])
81
assert has_revision(br_a2, br_a.revision_history()[2])
78
self.assertEquals(greedy_fetch(br_a2, br_a)[0], 9)
79
self.assert_(has_revision(br_a2, br_b.revision_history()[4]))
80
self.assert_(has_revision(br_a2, br_a.revision_history()[3]))
81
self.assert_(has_revision(br_a2, br_a.revision_history()[2]))
83
83
br_a3 = new_branch('br_a3')
84
assert greedy_fetch(br_a3, br_a2)[0] == 0
84
self.assertEquals(greedy_fetch(br_a3, br_a2)[0], 0)
85
85
for revno in range(4):
86
assert not has_revision(br_a3, br_a.revision_history()[revno])
86
self.assertFalse(has_revision(br_a3, br_a.revision_history()[revno]))
87
87
self.assertEqual(greedy_fetch(br_a3, br_a2, br_a.revision_history()[2])[0], 3)
88
88
fetched = greedy_fetch(br_a3, br_a2, br_a.revision_history()[3])[0]
89
assert fetched == 3, "fetched %d instead of 3" % fetched
89
self.assertEquals(fetched, 3, "fetched %d instead of 3" % fetched)
90
90
# InstallFailed should be raised if the branch is missing the revision
91
91
# that was requested.
92
92
self.assertRaises(bzrlib.errors.InstallFailed, greedy_fetch, br_a3,