/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_branch.py

Various small changes in aid of making tests pass (including deleting one invalid test).

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
 
153
153
    def get_unbalanced_tree_pair(self):
154
154
        """Return two branches, a and b, with one file in a."""
155
 
        get_transport(self.get_url()).mkdir('a')
156
155
        tree_a = self.make_branch_and_tree('a')
157
 
        file('a/b', 'wb').write('b')
 
156
        tree_a.bzrdir.root_transport.put_bytes_non_atomic('b', 'b')
158
157
        tree_a.add('b')
159
158
        tree_a.commit("silly commit", rev_id='A')
160
159
 
161
 
        get_transport(self.get_url()).mkdir('b')
162
160
        tree_b = self.make_branch_and_tree('b')
163
161
        return tree_a, tree_b
164
162
 
182
180
        """Copy only part of the history of a branch."""
183
181
        # TODO: RBC 20060208 test with a revision not on revision-history.
184
182
        #       what should that behaviour be ? Emailed the list.
 
183
        # First, make a branch with two commits.
185
184
        wt_a = self.make_branch_and_tree('a')
186
 
        self.build_tree(['a/one'])
 
185
        transport = wt_a.bzrdir.root_transport
 
186
        self.build_tree(['one'], transport=transport)
187
187
        wt_a.add(['one'])
188
188
        wt_a.commit('commit one', rev_id='1')
189
 
        self.build_tree(['a/two'])
 
189
        self.build_tree(['two'], transport=transport)
190
190
        wt_a.add(['two'])
191
191
        wt_a.commit('commit two', rev_id='2')
 
192
        # Now make a copy of the repository.
192
193
        repo_b = self.make_repository('b')
193
 
        wt_a.bzrdir.open_repository().copy_content_into(repo_b)
194
 
        br_b = wt_a.bzrdir.open_branch().clone(repo_b.bzrdir, revision_id='1')
 
194
        wt_a.branch.repository.copy_content_into(repo_b)
 
195
        # wt_a might be a lightweight checkout, so get a hold of the actual
 
196
        # branch (because you can't do a partial clone of a lightweight
 
197
        # checkout).
 
198
        branch = wt_a.branch.bzrdir.open_branch()
 
199
        # Then make a branch where the new repository is, but specify a revision
 
200
        # ID.  The new branch's history will stop at the specified revision.
 
201
        br_b = branch.clone(repo_b.bzrdir, revision_id='1')
195
202
        self.assertEqual('1', br_b.last_revision())
196
203
 
197
204
    def test_sprout_partial(self):
211
218
 
212
219
    def get_parented_branch(self):
213
220
        wt_a = self.make_branch_and_tree('a')
214
 
        self.build_tree(['a/one'])
 
221
        self.build_tree(['one'], transport=wt_a.bzrdir.root_transport)
215
222
        wt_a.add(['one'])
216
223
        wt_a.commit('commit one', rev_id='1')
217
224
 
240
247
        branch_d = branch_b.clone(repo_d.bzrdir)
241
248
        self.assertEqual(random_parent, branch_d.get_parent())
242
249
 
243
 
    def test_copy_content_incomplete(self):
244
 
        tree = self.make_branch_and_tree('commit_tree')
245
 
        self.build_tree(['foo'], transport=tree.bzrdir.root_transport)
246
 
        tree.add('foo')
247
 
        tree.commit('revision 1', rev_id='1')
248
 
        source = self.make_branch_and_tree('source')
249
 
        # this gives us an incomplete repository
250
 
        tree.bzrdir.open_repository().copy_content_into(
251
 
            source.branch.repository)
252
 
        tree.commit('revision 2', rev_id='2', allow_pointless=True)
253
 
        tree.bzrdir.open_branch().copy_content_into(source.branch)
254
 
 
255
 
 
256
250
    def test_sprout_branch_nickname(self):
257
251
        # test the nick name is reset always
258
252
        raise TestSkipped('XXX branch sprouting is not yet tested..')
333
327
    def test_branch_keeps_signatures(self):
334
328
        wt = self.make_branch_and_tree('source')
335
329
        wt.commit('A', allow_pointless=True, rev_id='A')
336
 
        wt.branch.repository.sign_revision('A',
337
 
            gpg.LoopbackGPGStrategy(None))
 
330
        repo = wt.branch.repository
 
331
        repo.sign_revision('A', gpg.LoopbackGPGStrategy(None))
338
332
        #FIXME: clone should work to urls,
339
333
        # wt.clone should work to disks.
340
334
        self.build_tree(['target/'])
341
 
        d2 = wt.bzrdir.clone('target')
342
 
        self.assertEqual(wt.branch.repository.get_signature_text('A'),
 
335
        d2 = repo.bzrdir.clone(urlutils.local_path_to_url('target'))
 
336
        self.assertEqual(repo.get_signature_text('A'),
343
337
                         d2.open_repository().get_signature_text('A'))
344
338
 
345
339
    def test_nicks(self):
467
461
        tree_a = self.make_branch_and_tree('a')
468
462
        rev_id = tree_a.commit('put some content in the branch')
469
463
        source_branch = bzrlib.branch.Branch.open(
470
 
            'readonly+' + tree_a.bzrdir.root_transport.base)
 
464
            'readonly+' + tree_a.branch.bzrdir.root_transport.base)
471
465
        # sanity check that the test will be valid
472
466
        self.assertRaises((errors.LockError, errors.TransportNotPossible),
473
467
            source_branch.lock_write)