~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_reconfigure.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-11-29 18:41:01 UTC
  • mfrom: (2796.2.22 bzr.reconfigure)
  • Revision ID: pqm@pqm.ubuntu.com-20071129184101-u9506rihe4zbzyyz
bzr reconfigure can now convert to lightweight checkout

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
        branch.set_push_location('sftp://push')
112
112
        self.assertEqual('sftp://push',
113
113
                         reconfiguration._select_bind_location())
114
 
        branch.set_bound_location('bzr:old-bound')
 
114
        branch.set_bound_location('bzr://foo/old-bound')
115
115
        branch.set_bound_location(None)
116
 
        self.assertEqual('bzr:old-bound',
 
116
        self.assertEqual('bzr://foo/old-bound',
 
117
                         reconfiguration._select_bind_location())
 
118
        branch.set_bound_location('bzr://foo/cur-bound')
 
119
        self.assertEqual('bzr://foo/cur-bound',
117
120
                         reconfiguration._select_bind_location())
118
121
        reconfiguration.new_bound_location = 'ftp://user-specified'
119
122
        self.assertEqual('ftp://user-specified',
148
151
        checkout = parent.create_checkout('checkout')
149
152
        self.assertRaises(errors.AlreadyCheckout,
150
153
                          reconfigure.Reconfigure.to_checkout, checkout.bzrdir)
 
154
 
 
155
    def test_checkout_to_lightweight(self):
 
156
        parent = self.make_branch('parent')
 
157
        checkout = parent.create_checkout('checkout')
 
158
        checkout.commit('test', rev_id='new-commit', local=True)
 
159
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
 
160
            checkout.bzrdir)
 
161
        reconfiguration.apply()
 
162
        wt = checkout.bzrdir.open_workingtree()
 
163
        self.assertTrue(parent.repository.has_same_location(
 
164
            wt.branch.repository))
 
165
        parent.repository.get_revision('new-commit')
 
166
        self.assertRaises(errors.NoRepositoryPresent,
 
167
                          checkout.bzrdir.open_repository)
 
168
 
 
169
    def test_branch_to_lightweight_checkout(self):
 
170
        parent = self.make_branch('parent')
 
171
        child = parent.bzrdir.sprout('child').open_workingtree()
 
172
        child.commit('test', rev_id='new-commit')
 
173
        child.bzrdir.destroy_workingtree()
 
174
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
 
175
            child.bzrdir)
 
176
        reconfiguration.apply()
 
177
        wt = child.bzrdir.open_workingtree()
 
178
        self.assertTrue(parent.repository.has_same_location(
 
179
            wt.branch.repository))
 
180
        parent.repository.get_revision('new-commit')
 
181
        self.assertRaises(errors.NoRepositoryPresent,
 
182
                          child.bzrdir.open_repository)
 
183
 
 
184
    def test_lightweight_checkout_to_lightweight_checkout(self):
 
185
        parent = self.make_branch('parent')
 
186
        checkout = parent.create_checkout('checkout', lightweight=True)
 
187
        self.assertRaises(errors.AlreadyLightweightCheckout,
 
188
                          reconfigure.Reconfigure.to_lightweight_checkout,
 
189
                          checkout.bzrdir)