/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/bzrdir_implementations/test_bzrdir.py

  • Committer: Robert Collins
  • Date: 2008-02-06 04:06:42 UTC
  • mfrom: (3216 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3217.
  • Revision ID: robertc@robertcollins.net-20080206040642-2efx3l4iv5f95lxp
Merge up with bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
                              % a_bzrdir.transport)
188
188
 
189
189
    def sproutOrSkip(self, from_bzrdir, to_url, revision_id=None,
190
 
                     force_new_repo=False):
 
190
                     force_new_repo=False, accelerator_tree=None):
191
191
        """Sprout from_bzrdir into to_url, or raise TestSkipped.
192
192
        
193
193
        A simple wrapper for from_bzrdir.sprout that translates NotLocalUrl into
198
198
            raise TestSkipped('Cannot sprout to remote bzrdirs.')
199
199
        target = from_bzrdir.sprout(to_url, revision_id=revision_id,
200
200
                                    force_new_repo=force_new_repo,
201
 
                                    possible_transports=[to_transport])
 
201
                                    possible_transports=[to_transport],
 
202
                                    accelerator_tree=accelerator_tree)
202
203
        return target
203
204
 
204
205
    def test_create_null_workingtree(self):
241
242
        bzrdir.create_branch()
242
243
        bzrdir.open_branch()
243
244
 
 
245
    def test_destroy_repository(self):
 
246
        repo = self.make_repository('repository')
 
247
        bzrdir = repo.bzrdir
 
248
        try:
 
249
            bzrdir.destroy_repository()
 
250
        except (errors.UnsupportedOperation, errors.TransportNotPossible):
 
251
            raise TestNotApplicable('Format does not support destroying'
 
252
                                    ' repository')
 
253
        self.assertRaises(errors.NoRepositoryPresent, bzrdir.open_repository)
 
254
        bzrdir.create_repository()
 
255
        bzrdir.open_repository()
 
256
 
244
257
    def test_open_workingtree_raises_no_working_tree(self):
245
258
        """BzrDir.open_workingtree() should raise NoWorkingTree (rather than
246
259
        e.g. NotLocalUrl) if there is no working tree.
1068
1081
        target = self.sproutOrSkip(dir, self.get_url('target'), revision_id='1')
1069
1082
        self.assertEqual(['1'], target.open_workingtree().get_parent_ids())
1070
1083
 
 
1084
    def test_sprout_takes_accelerator(self):
 
1085
        tree = self.make_branch_and_tree('source')
 
1086
        self.build_tree(['source/foo'])
 
1087
        tree.add('foo')
 
1088
        tree.commit('revision 1', rev_id='1')
 
1089
        tree.commit('revision 2', rev_id='2', allow_pointless=True)
 
1090
        dir = tree.bzrdir
 
1091
        target = self.sproutOrSkip(dir, self.get_url('target'),
 
1092
                                   accelerator_tree=tree)
 
1093
        self.assertEqual(['2'], target.open_workingtree().get_parent_ids())
 
1094
 
1071
1095
    def test_format_initialize_find_open(self):
1072
1096
        # loopback test to check the current format initializes to itself.
1073
1097
        if not self.bzrdir_format.is_supported():