~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testfetch.py

Merged Martin

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        os.mkdir(name)
43
43
        return Branch.initialize(name)
44
44
            
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)
49
49
 
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]))
53
53
 
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]))
59
59
 
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, [])
66
66
 
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]))
70
70
        
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]))
76
76
 
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]))
82
82
 
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,
104
104
 
105
105
    def test_fetch(self):
106
106
        #highest indices a: 5, b: 7
107
 
        br_a, br_b = make_branches()
 
107
        br_a, br_b = make_branches(self)
108
108
        fetch_steps(self, br_a, br_b, br_a)
109
109
 
110
110
 
187
187
 
188
188
    def test_fetch(self):
189
189
        #highest indices a: 5, b: 7
190
 
        br_a, br_b = make_branches()
 
190
        br_a, br_b = make_branches(self)
191
191
        br_rem_a = Branch.open(self.get_remote_url(br_a._transport.base))
192
192
        fetch_steps(self, br_rem_a, br_b, br_a)
193
193