~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_reconfigure.py

  • Committer: Martin Pool
  • Date: 2008-05-08 04:33:38 UTC
  • mfrom: (3414 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080508043338-ru3vflx8z641a76k
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
        self.assertRaises(errors.AlreadyCheckout,
198
198
                          reconfigure.Reconfigure.to_checkout, checkout.bzrdir)
199
199
 
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)
204
204
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
205
205
            checkout.bzrdir)
 
206
        return checkout, parent, reconfiguration
 
207
 
 
208
    def test_unsynced_checkout_to_lightweight(self):
 
209
        checkout, parent, reconfiguration = self.make_unsynced_checkout()
 
210
        self.assertRaises(errors.UnsyncedBranches, reconfiguration.apply)
 
211
 
 
212
    def test_synced_checkout_to_lightweight(self):
 
213
        checkout, parent, reconfiguration = self.make_unsynced_checkout()
 
214
        parent.pull(checkout.branch)
206
215
        reconfiguration.apply()
207
216
        wt = checkout.bzrdir.open_workingtree()
208
217
        self.assertTrue(parent.repository.has_same_location(
215
224
        parent = self.make_branch('parent')
216
225
        child = parent.bzrdir.sprout('child').open_workingtree()
217
226
        child.commit('test', rev_id='new-commit')
 
227
        parent.pull(child.branch)
218
228
        child.bzrdir.destroy_workingtree()
219
229
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
220
230
            child.bzrdir)
352
362
        tree = self.make_branch_and_tree('tree')
353
363
        self.assertRaises(errors.AlreadyStandalone,
354
364
                          reconfigure.Reconfigure.to_standalone, tree.bzrdir)
 
365
 
 
366
    def make_unsynced_branch_reconfiguration(self):
 
367
        parent = self.make_branch_and_tree('parent')
 
368
        parent.commit('commit 1')
 
369
        child = parent.bzrdir.sprout('child').open_workingtree()
 
370
        child.commit('commit 2')
 
371
        return reconfigure.Reconfigure.to_lightweight_checkout(child.bzrdir)
 
372
 
 
373
    def test_unsynced_branch_to_lightweight_checkout_unforced(self):
 
374
        reconfiguration = self.make_unsynced_branch_reconfiguration()
 
375
        self.assertRaises(errors.UnsyncedBranches, reconfiguration.apply)
 
376
 
 
377
    def test_unsynced_branch_to_lightweight_checkout_forced(self):
 
378
        reconfiguration = self.make_unsynced_branch_reconfiguration()
 
379
        reconfiguration.apply(force=True)