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

  • Committer: Robert Collins
  • Date: 2006-02-14 04:07:06 UTC
  • mto: (1534.5.2 bzr-dir)
  • mto: This revision was merged to the branch mainline in revision 1554.
  • Revision ID: robertc@robertcollins.net-20060214040706-ab43d8450989c555
Move find_repository to bzrdir, its not quite ideal there but its simpler and until someone chooses to vary the search by branch type its completely sufficient.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
        """See BzrDir.create_repository."""
67
67
        return "A repository"
68
68
 
 
69
    def open_repository(self):
 
70
        """See BzrDir.open_repository."""
 
71
        return "A repository"
 
72
 
69
73
    def create_branch(self):
70
74
        """See BzrDir.create_branch."""
71
75
        return SampleBranch(self)
157
161
        finally:
158
162
            bzrdir.BzrDirFormat.set_default_format(old_format)
159
163
 
160
 
    def test_create_branch_and_repo(self):
 
164
    def test_create_branch_and_repo_uses_default(self):
161
165
        format = SampleBzrDirFormat()
162
166
        old_format = bzrdir.BzrDirFormat.get_default_format()
163
167
        bzrdir.BzrDirFormat.set_default_format(format)
167
171
        finally:
168
172
            bzrdir.BzrDirFormat.set_default_format(old_format)
169
173
 
 
174
    def test_create_branch_and_repo_under_shared(self):
 
175
        # creating a branch and repo in a shared repo uses the
 
176
        # shared repository
 
177
        old_format = bzrdir.BzrDirFormat.get_default_format()
 
178
        bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
 
179
        try:
 
180
            self.make_repository('.', shared=True)
 
181
            branch = bzrdir.BzrDir.create_branch_and_repo(self.get_url('child'))
 
182
            self.assertRaises(errors.NoRepositoryPresent,
 
183
                              branch.bzrdir.open_repository)
 
184
        finally:
 
185
            bzrdir.BzrDirFormat.set_default_format(old_format)
 
186
 
 
187
    def test_create_branch_and_repo_under_shared_force_new(self):
 
188
        # creating a branch and repo in a shared repo can be forced to 
 
189
        # make a new repo
 
190
        old_format = bzrdir.BzrDirFormat.get_default_format()
 
191
        bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
 
192
        try:
 
193
            self.make_repository('.', shared=True)
 
194
            branch = bzrdir.BzrDir.create_branch_and_repo(self.get_url('child'),
 
195
                                                          force_new_repo=True)
 
196
            branch.bzrdir.open_repository()
 
197
        finally:
 
198
            bzrdir.BzrDirFormat.set_default_format(old_format)
 
199
 
170
200
    def test_create_standalone_working_tree(self):
171
201
        format = SampleBzrDirFormat()
172
202
        old_format = bzrdir.BzrDirFormat.get_default_format()