~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_fetch.py

 * The internal storage of history, and logical branch identity have now
   been split into Branch, and Repository. The common locking and file 
   management routines are now in bzrlib.lockablefiles. 
   (Aaron Bentley, Robert Collins, Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib.branch import Branch
24
24
from bzrlib.fetch import greedy_fetch
25
25
from bzrlib.merge import merge
26
 
from bzrlib.clone import copy_branch
27
26
 
28
27
from bzrlib.tests import TestCaseInTempDir
29
28
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
31
30
 
32
31
def has_revision(branch, revision_id):
33
32
    try:
34
 
        branch.get_revision_xml(revision_id)
 
33
        branch.repository.get_revision_xml_file(revision_id)
35
34
        return True
36
35
    except bzrlib.errors.NoSuchRevision:
37
36
        return False
128
127
        os.mkdir('br1')
129
128
        br1 = Branch.initialize('br1')
130
129
        br1.working_tree().commit(message='rev 1-1', rev_id='1-1')
131
 
        copy_branch(br1, 'br2')
 
130
        br1.clone('br2')
132
131
        br2 = Branch.open('br2')
133
132
        br1.working_tree().commit(message='rev 1-2', rev_id='1-2')
134
133
        br2.working_tree().commit(message='rev 2-1', rev_id='2-1')
138
137
 
139
138
    def _check_revs_present(self, br2):
140
139
        for rev_id in '1-1', '1-2', '2-1':
141
 
            self.assertTrue(br2.has_revision(rev_id))
142
 
            rev = br2.get_revision(rev_id)
 
140
            self.assertTrue(br2.repository.has_revision(rev_id))
 
141
            rev = br2.repository.get_revision(rev_id)
143
142
            self.assertEqual(rev.revision_id, rev_id)
144
 
            self.assertTrue(br2.get_inventory(rev_id))
 
143
            self.assertTrue(br2.repository.get_inventory(rev_id))
145
144
 
146
145
 
147
146
 
153
152
        self.build_tree_contents([('br1/file', 'original contents\n')])
154
153
        br1.working_tree().add(['file'], ['this-file-id'])
155
154
        br1.working_tree().commit(message='rev 1-1', rev_id='1-1')
156
 
        copy_branch(br1, 'br2')
 
155
        br1.clone('br2')
157
156
        br2 = Branch.open('br2')
158
157
        self.build_tree_contents([('br1/file', 'original from 1\n')])
159
158
        br1.working_tree().commit(message='rev 1-2', rev_id='1-2')
173
172
                             ('1-3', 'agreement\n'),
174
173
                             ('2-1', 'contents in 2\n'),
175
174
                             ('2-2', 'agreement\n')]:
176
 
            self.assertEqualDiff(br2.revision_tree(rev_id).get_file_text('this-file-id'),
177
 
                                 text)
 
175
            self.assertEqualDiff(
 
176
                br2.repository.revision_tree(
 
177
                    rev_id).get_file_text('this-file-id'), text)
178
178
 
179
179
 
180
180
 
184
184
    def test_fetch(self):
185
185
        #highest indices a: 5, b: 7
186
186
        br_a, br_b = make_branches(self)
187
 
        br_rem_a = Branch.open(self.get_remote_url(br_a._transport.base))
 
187
        br_rem_a = Branch.open(self.get_remote_url(br_a.base))
188
188
        fetch_steps(self, br_rem_a, br_b, br_a)
189
189
 
190
190
    def test_weaves_are_retrieved_once(self):