~toddy/bzr/bzr.i18n

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_reconfigure.py

  • Committer: Tobias Toedter
  • Date: 2007-12-30 18:52:13 UTC
  • mfrom: (2438.1.708 +trunk)
  • Revision ID: t.toedter@gmx.net-20071230185213-7xiqpbtshmnsf073
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
    branch as _mod_branch,
19
19
    errors,
20
20
    reconfigure,
 
21
    repository,
21
22
    tests,
22
23
    workingtree,
23
24
    )
49
50
 
50
51
    def test_repo_to_branch(self):
51
52
        repo = self.make_repository('repo')
52
 
        self.assertRaises(errors.ReconfigurationNotSupported,
53
 
                          reconfigure.Reconfigure.to_branch, repo.bzrdir)
 
53
        reconfiguration = reconfigure.Reconfigure.to_branch(repo.bzrdir)
 
54
        reconfiguration.apply()
54
55
 
55
56
    def test_checkout_to_branch(self):
56
57
        branch = self.make_branch('branch')
146
147
                                                              parent.base)
147
148
        reconfiguration.apply()
148
149
 
 
150
    def test_tree_to_lightweight_checkout(self):
 
151
        # A tree with no related branches and no supplied bind location cannot
 
152
        # become a checkout
 
153
        parent = self.make_branch('parent')
 
154
 
 
155
        tree = self.make_branch_and_tree('tree')
 
156
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
 
157
            tree.bzrdir)
 
158
        self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
 
159
        # setting a parent allows it to become a checkout
 
160
        tree.branch.set_parent(parent.base)
 
161
        reconfiguration.apply()
 
162
        # supplying a location allows it to become a checkout
 
163
        tree2 = self.make_branch_and_tree('tree2')
 
164
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
 
165
            tree2.bzrdir, parent.base)
 
166
        reconfiguration.apply()
 
167
 
149
168
    def test_checkout_to_checkout(self):
150
169
        parent = self.make_branch('parent')
151
170
        checkout = parent.create_checkout('checkout')
187
206
        self.assertRaises(errors.AlreadyLightweightCheckout,
188
207
                          reconfigure.Reconfigure.to_lightweight_checkout,
189
208
                          checkout.bzrdir)
 
209
 
 
210
    def test_repo_to_tree(self):
 
211
        repo = self.make_repository('repo')
 
212
        reconfiguration = reconfigure.Reconfigure.to_tree(repo.bzrdir)
 
213
        reconfiguration.apply()
 
214
        workingtree.WorkingTree.open('repo')
 
215
 
 
216
    def test_shared_repo_to_lightweight_checkout(self):
 
217
        repo = self.make_repository('repo', shared=True)
 
218
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
 
219
            repo.bzrdir)
 
220
        self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
 
221
        branch = self.make_branch('branch')
 
222
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
 
223
            repo.bzrdir, 'branch')
 
224
        reconfiguration.apply()
 
225
        workingtree.WorkingTree.open('repo')
 
226
        repository.Repository.open('repo')
 
227
 
 
228
    def test_unshared_repo_to_lightweight_checkout(self):
 
229
        repo = self.make_repository('repo', shared=False)
 
230
        branch = self.make_branch('branch')
 
231
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
 
232
            repo.bzrdir, 'branch')
 
233
        reconfiguration.apply()
 
234
        workingtree.WorkingTree.open('repo')
 
235
        self.assertRaises(errors.NoRepositoryPresent,
 
236
                          repository.Repository.open, 'repo')