197
197
self.assertRaises(errors.AlreadyCheckout,
198
198
reconfigure.Reconfigure.to_checkout, checkout.bzrdir)
200
def test_checkout_to_lightweight(self):
200
def make_unsynced_checkout(self):
201
201
parent = self.make_branch('parent')
202
202
checkout = parent.create_checkout('checkout')
203
203
checkout.commit('test', rev_id='new-commit', local=True)
205
# work around fetch bug 212908
206
checkout.commit('test2', local=True)
207
checkout.branch.set_last_revision_info(1, 'new-commit')
204
208
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
210
return checkout, parent, reconfiguration
212
def test_unsynced_checkout_to_lightweight(self):
213
checkout, parent, reconfiguration = self.make_unsynced_checkout()
214
self.assertRaises(errors.UnsyncedBranches, reconfiguration.apply)
216
def test_synced_checkout_to_lightweight(self):
217
checkout, parent, reconfiguration = self.make_unsynced_checkout()
218
parent.pull(checkout.branch)
206
219
reconfiguration.apply()
207
220
wt = checkout.bzrdir.open_workingtree()
208
221
self.assertTrue(parent.repository.has_same_location(
215
228
parent = self.make_branch('parent')
216
229
child = parent.bzrdir.sprout('child').open_workingtree()
217
230
child.commit('test', rev_id='new-commit')
231
parent.pull(child.branch)
232
# work around fetch bug 212908
233
child.commit('test', rev_id='new-commit2')
234
child.branch.set_last_revision_info(1, 'new-commit')
218
235
child.bzrdir.destroy_workingtree()
219
236
reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
352
369
tree = self.make_branch_and_tree('tree')
353
370
self.assertRaises(errors.AlreadyStandalone,
354
371
reconfigure.Reconfigure.to_standalone, tree.bzrdir)
373
def make_unsynced_branch_reconfiguration(self):
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')
378
return reconfigure.Reconfigure.to_lightweight_checkout(child.bzrdir)
380
def test_unsynced_branch_to_lightweight_checkout_unforced(self):
381
reconfiguration = self.make_unsynced_branch_reconfiguration()
382
self.assertRaises(errors.UnsyncedBranches, reconfiguration.apply)
384
def test_unsynced_branch_to_lightweight_checkout_forced(self):
385
reconfiguration = self.make_unsynced_branch_reconfiguration()
386
reconfiguration.apply(force=True)