/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
1
# Copyright (C) 2007 Canonical Ltd
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
from bzrlib import (
18
    branch as _mod_branch,
19
    errors,
20
    reconfigure,
2796.2.25 by Aaron Bentley
Avoid destroying shared repositories
21
    repository,
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
22
    tests,
23
    workingtree,
24
    )
25
26
27
class TestReconfigure(tests.TestCaseWithTransport):
28
29
    def test_tree_to_branch(self):
30
        tree = self.make_branch_and_tree('tree')
31
        reconfiguration = reconfigure.Reconfigure.to_branch(tree.bzrdir)
32
        reconfiguration.apply()
33
        self.assertRaises(errors.NoWorkingTree, workingtree.WorkingTree.open,
34
                          'tree')
35
36
    def test_modified_tree_to_branch(self):
37
        tree = self.make_branch_and_tree('tree')
38
        self.build_tree(['tree/file'])
39
        tree.add('file')
40
        reconfiguration = reconfigure.Reconfigure.to_branch(tree.bzrdir)
41
        self.assertRaises(errors.UncommittedChanges, reconfiguration.apply)
42
        reconfiguration.apply(force=True)
43
        self.assertRaises(errors.NoWorkingTree, workingtree.WorkingTree.open,
44
                          'tree')
45
46
    def test_branch_to_branch(self):
47
        branch = self.make_branch('branch')
48
        self.assertRaises(errors.AlreadyBranch,
49
                          reconfigure.Reconfigure.to_branch, branch.bzrdir)
50
51
    def test_repo_to_branch(self):
52
        repo = self.make_repository('repo')
2796.2.23 by Aaron Bentley
Add support for reconfiguring repositories into branches or trees
53
        reconfiguration = reconfigure.Reconfigure.to_branch(repo.bzrdir)
54
        reconfiguration.apply()
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
55
56
    def test_checkout_to_branch(self):
57
        branch = self.make_branch('branch')
58
        checkout = branch.create_checkout('checkout')
59
        reconfiguration = reconfigure.Reconfigure.to_branch(checkout.bzrdir)
60
        reconfiguration.apply()
61
        self.assertIs(None, checkout.branch.get_bound_location())
2796.2.2 by Aaron Bentley
Refuse to turn lightweight checkouts into branches
62
2796.2.32 by Aaron Bentley
Preserve tags converting from lightweight checkouts
63
    def prepare_lightweight_checkout_to_branch(self):
64
        branch = self.make_branch('branch')
65
        checkout = branch.create_checkout('checkout', lightweight=True)
66
        checkout.commit('first commit', rev_id='rev1')
67
        reconfiguration = reconfigure.Reconfigure.to_branch(checkout.bzrdir)
68
        return reconfiguration, checkout
69
2796.2.2 by Aaron Bentley
Refuse to turn lightweight checkouts into branches
70
    def test_lightweight_checkout_to_branch(self):
2796.2.32 by Aaron Bentley
Preserve tags converting from lightweight checkouts
71
        reconfiguration, checkout = \
72
            self.prepare_lightweight_checkout_to_branch()
2796.2.7 by Aaron Bentley
Implement converting a lightweight checkout to a branch
73
        reconfiguration.apply()
74
        checkout_branch = checkout.bzrdir.open_branch()
75
        self.assertEqual(checkout_branch.bzrdir.root_transport.base,
76
                         checkout.bzrdir.root_transport.base)
2796.2.8 by Aaron Bentley
Ensure conversion from lightweight fetches revisions and sets revision info
77
        self.assertEqual('rev1', checkout_branch.last_revision())
78
        repo = checkout.bzrdir.open_repository()
79
        repo.get_revision('rev1')
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
80
2796.2.32 by Aaron Bentley
Preserve tags converting from lightweight checkouts
81
    def test_lightweight_checkout_to_branch_tags(self):
82
        reconfiguration, checkout = \
83
            self.prepare_lightweight_checkout_to_branch()
84
        checkout.branch.tags.set_tag('foo', 'bar')
85
        reconfiguration.apply()
86
        checkout_branch = checkout.bzrdir.open_branch()
87
        self.assertEqual('bar', checkout_branch.tags.lookup_tag('foo'))
88
2796.2.33 by Aaron Bentley
Add lightweight-checkout-to-checkout tags test
89
    def prepare_lightweight_checkout_to_checkout(self):
90
        branch = self.make_branch('branch')
91
        checkout = branch.create_checkout('checkout', lightweight=True)
92
        reconfiguration = reconfigure.Reconfigure.to_checkout(checkout.bzrdir)
93
        return reconfiguration, checkout
94
2796.2.9 by Aaron Bentley
Ensure conversion from lightweight checkout works
95
    def test_lightweight_checkout_to_checkout(self):
2796.2.33 by Aaron Bentley
Add lightweight-checkout-to-checkout tags test
96
        reconfiguration, checkout = \
97
            self.prepare_lightweight_checkout_to_checkout()
2796.2.9 by Aaron Bentley
Ensure conversion from lightweight checkout works
98
        reconfiguration.apply()
99
        checkout_branch = checkout.bzrdir.open_branch()
100
        self.assertIsNot(checkout_branch.get_bound_location(), None)
101
2796.2.33 by Aaron Bentley
Add lightweight-checkout-to-checkout tags test
102
    def test_lightweight_checkout_to_checkout_tags(self):
103
        reconfiguration, checkout = \
104
            self.prepare_lightweight_checkout_to_checkout()
105
        checkout.branch.tags.set_tag('foo', 'bar')
106
        reconfiguration.apply()
107
        checkout_branch = checkout.bzrdir.open_branch()
108
        self.assertEqual('bar', checkout_branch.tags.lookup_tag('foo'))
109
2796.2.10 by Aaron Bentley
Ensure that shared repositories are used where possible
110
    def test_lightweight_conversion_uses_shared_repo(self):
111
        parent = self.make_branch('parent')
112
        shared_repo = self.make_repository('repo', shared=True)
113
        checkout = parent.create_checkout('repo/checkout', lightweight=True)
114
        reconfigure.Reconfigure.to_tree(checkout.bzrdir).apply()
115
        checkout_repo = checkout.bzrdir.open_branch().repository
116
        self.assertEqual(shared_repo.bzrdir.root_transport.base,
117
                         checkout_repo.bzrdir.root_transport.base)
118
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
119
    def test_branch_to_tree(self):
120
        branch = self.make_branch('branch')
121
        reconfiguration=reconfigure.Reconfigure.to_tree(branch.bzrdir)
122
        reconfiguration.apply()
123
        branch.bzrdir.open_workingtree()
124
125
    def test_tree_to_tree(self):
126
        tree = self.make_branch_and_tree('tree')
127
        self.assertRaises(errors.AlreadyTree, reconfigure.Reconfigure.to_tree,
128
                          tree.bzrdir)
129
130
    def test_select_bind_location(self):
131
        branch = self.make_branch('branch')
132
        reconfiguration = reconfigure.Reconfigure(branch.bzrdir)
133
        self.assertRaises(errors.NoBindLocation,
134
                          reconfiguration._select_bind_location)
135
        branch.set_parent('http://parent')
136
        self.assertEqual('http://parent',
137
                         reconfiguration._select_bind_location())
138
        branch.set_push_location('sftp://push')
139
        self.assertEqual('sftp://push',
140
                         reconfiguration._select_bind_location())
2796.2.22 by Aaron Bentley
Tweak from review
141
        branch.set_bound_location('bzr://foo/old-bound')
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
142
        branch.set_bound_location(None)
2796.2.22 by Aaron Bentley
Tweak from review
143
        self.assertEqual('bzr://foo/old-bound',
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
144
                         reconfiguration._select_bind_location())
2796.2.22 by Aaron Bentley
Tweak from review
145
        branch.set_bound_location('bzr://foo/cur-bound')
146
        self.assertEqual('bzr://foo/cur-bound',
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
147
                         reconfiguration._select_bind_location())
2796.2.11 by Aaron Bentley
Cleanups
148
        reconfiguration.new_bound_location = 'ftp://user-specified'
149
        self.assertEqual('ftp://user-specified',
150
                         reconfiguration._select_bind_location())
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
151
2796.2.9 by Aaron Bentley
Ensure conversion from lightweight checkout works
152
    def test_select_reference_bind_location(self):
153
        branch = self.make_branch('branch')
154
        checkout = branch.create_checkout('checkout', lightweight=True)
155
        reconfiguration = reconfigure.Reconfigure(checkout.bzrdir)
156
        self.assertEqual(branch.base,
157
                         reconfiguration._select_bind_location())
158
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
159
    def test_tree_to_checkout(self):
160
        # A tree with no related branches and no supplied bind location cannot
161
        # become a checkout
162
        parent = self.make_branch('parent')
163
164
        tree = self.make_branch_and_tree('tree')
165
        reconfiguration = reconfigure.Reconfigure.to_checkout(tree.bzrdir)
166
        self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
167
        # setting a parent allows it to become a checkout
168
        tree.branch.set_parent(parent.base)
169
        reconfiguration.apply()
170
        # supplying a location allows it to become a checkout
171
        tree2 = self.make_branch_and_tree('tree2')
172
        reconfiguration = reconfigure.Reconfigure.to_checkout(tree2.bzrdir,
173
                                                              parent.base)
2796.2.4 by Aaron Bentley
Fix support for reconfiguring to selected bound location
174
        reconfiguration.apply()
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
175
2796.2.26 by Aaron Bentley
Support converting standalone tree to lightweight checkout
176
    def test_tree_to_lightweight_checkout(self):
177
        # A tree with no related branches and no supplied bind location cannot
178
        # become a checkout
179
        parent = self.make_branch('parent')
180
181
        tree = self.make_branch_and_tree('tree')
182
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
183
            tree.bzrdir)
184
        self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
185
        # setting a parent allows it to become a checkout
186
        tree.branch.set_parent(parent.base)
187
        reconfiguration.apply()
188
        # supplying a location allows it to become a checkout
189
        tree2 = self.make_branch_and_tree('tree2')
190
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
191
            tree2.bzrdir, parent.base)
192
        reconfiguration.apply()
193
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
194
    def test_checkout_to_checkout(self):
195
        parent = self.make_branch('parent')
196
        checkout = parent.create_checkout('checkout')
197
        self.assertRaises(errors.AlreadyCheckout,
198
                          reconfigure.Reconfigure.to_checkout, checkout.bzrdir)
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
199
3338.1.2 by Aaron Bentley
Split out tests even further
200
    def make_unsynced_checkout(self):
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
201
        parent = self.make_branch('parent')
202
        checkout = parent.create_checkout('checkout')
203
        checkout.commit('test', rev_id='new-commit', local=True)
3338.1.2 by Aaron Bentley
Split out tests even further
204
205
        # work around fetch bug 212908
206
        checkout.commit('test2', local=True)
207
        checkout.branch.set_last_revision_info(1, 'new-commit')
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
208
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
209
            checkout.bzrdir)
3338.1.2 by Aaron Bentley
Split out tests even further
210
        return checkout, parent, reconfiguration
211
212
    def test_unsynced_checkout_to_lightweight(self):
213
        checkout, parent, reconfiguration = self.make_unsynced_checkout()
3338.1.1 by Aaron Bentley
Raise an error when converting a branch to a lightweight checkout loses data
214
        self.assertRaises(errors.UnsyncedBranches, reconfiguration.apply)
3338.1.2 by Aaron Bentley
Split out tests even further
215
216
    def test_synced_checkout_to_lightweight(self):
217
        checkout, parent, reconfiguration = self.make_unsynced_checkout()
3338.1.1 by Aaron Bentley
Raise an error when converting a branch to a lightweight checkout loses data
218
        parent.pull(checkout.branch)
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
219
        reconfiguration.apply()
220
        wt = checkout.bzrdir.open_workingtree()
221
        self.assertTrue(parent.repository.has_same_location(
222
            wt.branch.repository))
223
        parent.repository.get_revision('new-commit')
224
        self.assertRaises(errors.NoRepositoryPresent,
225
                          checkout.bzrdir.open_repository)
226
2796.2.31 by Aaron Bentley
Fetch tags to reference branch when converting to checkout
227
    def prepare_branch_to_lightweight_checkout(self):
228
        parent = self.make_branch('parent')
229
        child = parent.bzrdir.sprout('child').open_workingtree()
230
        child.commit('test', rev_id='new-commit')
3338.1.1 by Aaron Bentley
Raise an error when converting a branch to a lightweight checkout loses data
231
        parent.pull(child.branch)
3338.1.2 by Aaron Bentley
Split out tests even further
232
        # work around fetch bug 212908
3338.1.1 by Aaron Bentley
Raise an error when converting a branch to a lightweight checkout loses data
233
        child.commit('test', rev_id='new-commit2')
3338.1.2 by Aaron Bentley
Split out tests even further
234
        child.branch.set_last_revision_info(1, 'new-commit')
2796.2.31 by Aaron Bentley
Fetch tags to reference branch when converting to checkout
235
        child.bzrdir.destroy_workingtree()
236
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
237
            child.bzrdir)
238
        return parent, child, reconfiguration
239
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
240
    def test_branch_to_lightweight_checkout(self):
2796.2.31 by Aaron Bentley
Fetch tags to reference branch when converting to checkout
241
        parent, child, reconfiguration = \
242
            self.prepare_branch_to_lightweight_checkout()
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
243
        reconfiguration.apply()
2796.2.31 by Aaron Bentley
Fetch tags to reference branch when converting to checkout
244
        self.assertTrue(reconfiguration._destroy_branch)
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
245
        wt = child.bzrdir.open_workingtree()
246
        self.assertTrue(parent.repository.has_same_location(
247
            wt.branch.repository))
248
        parent.repository.get_revision('new-commit')
249
        self.assertRaises(errors.NoRepositoryPresent,
250
                          child.bzrdir.open_repository)
251
2796.2.30 by Aaron Bentley
Reconfigure can safely be interrupted while fetching (#179316)
252
    def test_branch_to_lightweight_checkout_failure(self):
2796.2.31 by Aaron Bentley
Fetch tags to reference branch when converting to checkout
253
        parent, child, reconfiguration = \
254
            self.prepare_branch_to_lightweight_checkout()
2796.2.30 by Aaron Bentley
Reconfigure can safely be interrupted while fetching (#179316)
255
        old_Repository_fetch = repository.Repository.fetch
256
        repository.Repository.fetch = None
257
        try:
258
            self.assertRaises(TypeError, reconfiguration.apply)
259
        finally:
260
            repository.Repository.fetch = old_Repository_fetch
261
        child = _mod_branch.Branch.open('child')
262
        self.assertContainsRe(child.base, 'child/$')
263
2796.2.31 by Aaron Bentley
Fetch tags to reference branch when converting to checkout
264
    def test_branch_to_lightweight_checkout_fetch_tags(self):
265
        parent, child, reconfiguration = \
266
            self.prepare_branch_to_lightweight_checkout()
267
        child.branch.tags.set_tag('foo', 'bar')
268
        reconfiguration.apply()
269
        child = _mod_branch.Branch.open('child')
270
        self.assertEqual('bar', parent.tags.lookup_tag('foo'))
271
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
272
    def test_lightweight_checkout_to_lightweight_checkout(self):
273
        parent = self.make_branch('parent')
274
        checkout = parent.create_checkout('checkout', lightweight=True)
275
        self.assertRaises(errors.AlreadyLightweightCheckout,
276
                          reconfigure.Reconfigure.to_lightweight_checkout,
277
                          checkout.bzrdir)
2796.2.23 by Aaron Bentley
Add support for reconfiguring repositories into branches or trees
278
279
    def test_repo_to_tree(self):
280
        repo = self.make_repository('repo')
281
        reconfiguration = reconfigure.Reconfigure.to_tree(repo.bzrdir)
282
        reconfiguration.apply()
283
        workingtree.WorkingTree.open('repo')
284
2796.2.25 by Aaron Bentley
Avoid destroying shared repositories
285
    def test_shared_repo_to_lightweight_checkout(self):
286
        repo = self.make_repository('repo', shared=True)
2796.2.23 by Aaron Bentley
Add support for reconfiguring repositories into branches or trees
287
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
288
            repo.bzrdir)
289
        self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
290
        branch = self.make_branch('branch')
291
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
292
            repo.bzrdir, 'branch')
293
        reconfiguration.apply()
2796.2.25 by Aaron Bentley
Avoid destroying shared repositories
294
        workingtree.WorkingTree.open('repo')
295
        repository.Repository.open('repo')
296
297
    def test_unshared_repo_to_lightweight_checkout(self):
298
        repo = self.make_repository('repo', shared=False)
299
        branch = self.make_branch('branch')
300
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
301
            repo.bzrdir, 'branch')
302
        reconfiguration.apply()
303
        workingtree.WorkingTree.open('repo')
304
        self.assertRaises(errors.NoRepositoryPresent,
305
                          repository.Repository.open, 'repo')
3311.2.1 by Aaron Bentley
Initial make-sharing functionality
306
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
307
    def test_standalone_to_use_shared(self):
3311.2.1 by Aaron Bentley
Initial make-sharing functionality
308
        self.build_tree(['root/'])
309
        tree = self.make_branch_and_tree('root/tree')
310
        tree.commit('Hello', rev_id='hello-id')
311
        repo = self.make_repository('root', shared=True)
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
312
        reconfiguration = reconfigure.Reconfigure.to_use_shared(tree.bzrdir)
3311.2.1 by Aaron Bentley
Initial make-sharing functionality
313
        reconfiguration.apply()
314
        tree = workingtree.WorkingTree.open('root/tree')
315
        self.assertTrue(repo.has_same_location(tree.branch.repository))
316
        self.assertEqual('Hello', repo.get_revision('hello-id').message)
3311.2.2 by Aaron Bentley
Flesh out to_sharing
317
3311.2.7 by Aaron Bentley
Get head preservation under test
318
    def add_dead_head(self, tree):
319
        revno, revision_id = tree.branch.last_revision_info()
320
        tree.commit('Dead head', rev_id='dead-head-id')
321
        tree.branch.set_last_revision_info(revno, revision_id)
322
        tree.set_last_revision(revision_id)
323
324
    def test_standalone_to_use_shared_preserves_dead_heads(self):
325
        self.build_tree(['root/'])
326
        tree = self.make_branch_and_tree('root/tree')
327
        self.add_dead_head(tree)
328
        tree.commit('Hello', rev_id='hello-id')
329
        repo = self.make_repository('root', shared=True)
330
        reconfiguration = reconfigure.Reconfigure.to_use_shared(tree.bzrdir)
331
        reconfiguration.apply()
332
        tree = workingtree.WorkingTree.open('root/tree')
333
        message = repo.get_revision('dead-head-id').message
334
        self.assertEqual('Dead head', message)
335
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
336
    def make_repository_tree(self):
3311.2.4 by Aaron Bentley
Implement conversion to standalone
337
        self.build_tree(['root/'])
338
        repo = self.make_repository('root', shared=True)
339
        tree = self.make_branch_and_tree('root/tree')
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
340
        reconfigure.Reconfigure.to_use_shared(tree.bzrdir).apply()
3311.2.4 by Aaron Bentley
Implement conversion to standalone
341
        return workingtree.WorkingTree.open('root/tree')
342
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
343
    def test_use_shared_to_use_shared(self):
344
        tree = self.make_repository_tree()
345
        self.assertRaises(errors.AlreadyUsingShared,
346
                          reconfigure.Reconfigure.to_use_shared, tree.bzrdir)
3311.2.4 by Aaron Bentley
Implement conversion to standalone
347
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
348
    def test_use_shared_to_standalone(self):
349
        tree = self.make_repository_tree()
3311.2.4 by Aaron Bentley
Implement conversion to standalone
350
        tree.commit('Hello', rev_id='hello-id')
351
        reconfigure.Reconfigure.to_standalone(tree.bzrdir).apply()
352
        tree = workingtree.WorkingTree.open('root/tree')
353
        repo = tree.branch.repository
354
        self.assertEqual(repo.bzrdir.root_transport.base,
355
                         tree.bzrdir.root_transport.base)
356
        self.assertEqual('Hello', repo.get_revision('hello-id').message)
357
3311.2.7 by Aaron Bentley
Get head preservation under test
358
    def test_use_shared_to_standalone_preserves_dead_heads(self):
359
        tree = self.make_repository_tree()
360
        self.add_dead_head(tree)
361
        tree.commit('Hello', rev_id='hello-id')
362
        reconfigure.Reconfigure.to_standalone(tree.bzrdir).apply()
363
        tree = workingtree.WorkingTree.open('root/tree')
364
        repo = tree.branch.repository
365
        self.assertRaises(errors.NoSuchRevision, repo.get_revision,
366
                          'dead-head-id')
367
3311.2.4 by Aaron Bentley
Implement conversion to standalone
368
    def test_standalone_to_standalone(self):
369
        tree = self.make_branch_and_tree('tree')
370
        self.assertRaises(errors.AlreadyStandalone,
371
                          reconfigure.Reconfigure.to_standalone, tree.bzrdir)
3338.1.3 by Aaron Bentley
Merge bzr.dev
372
3338.1.2 by Aaron Bentley
Split out tests even further
373
    def make_unsynced_branch_reconfiguration(self):
3338.1.1 by Aaron Bentley
Raise an error when converting a branch to a lightweight checkout loses data
374
        parent = self.make_branch_and_tree('parent')
375
        parent.commit('commit 1')
376
        child = parent.bzrdir.sprout('child').open_workingtree()
377
        child.commit('commit 2')
3338.1.2 by Aaron Bentley
Split out tests even further
378
        return reconfigure.Reconfigure.to_lightweight_checkout(child.bzrdir)
379
380
    def test_unsynced_branch_to_lightweight_checkout_unforced(self):
381
        reconfiguration = self.make_unsynced_branch_reconfiguration()
3338.1.1 by Aaron Bentley
Raise an error when converting a branch to a lightweight checkout loses data
382
        self.assertRaises(errors.UnsyncedBranches, reconfiguration.apply)
3338.1.2 by Aaron Bentley
Split out tests even further
383
384
    def test_unsynced_branch_to_lightweight_checkout_forced(self):
385
        reconfiguration = self.make_unsynced_branch_reconfiguration()
3338.1.1 by Aaron Bentley
Raise an error when converting a branch to a lightweight checkout loses data
386
        reconfiguration.apply(force=True)