~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_reconfigure.py

  • Committer: Patch Queue Manager
  • Date: 2012-02-14 18:29:43 UTC
  • mfrom: (6404.6.11 cached-branch-store)
  • Revision ID: pqm@pqm.ubuntu.com-20120214182943-vso6j0mqdnxfkp7s
(vila) Cache the branch config store to avoid useless IOs. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2007, 2008, 2009, 2011, 2012 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
72
72
        checkout = branch.create_checkout('checkout')
73
73
        reconfiguration = reconfigure.Reconfigure.to_branch(checkout.bzrdir)
74
74
        reconfiguration.apply()
75
 
        self.assertIs(None, checkout.branch.get_bound_location())
 
75
        reconfigured = bzrdir.BzrDir.open('checkout').open_branch()
 
76
        self.assertIs(None, reconfigured.get_bound_location())
76
77
 
77
78
    def prepare_lightweight_checkout_to_branch(self):
78
79
        branch = self.make_branch('branch')
147
148
        self.assertRaises(errors.NoBindLocation,
148
149
                          reconfiguration._select_bind_location)
149
150
        branch.set_parent('http://parent')
 
151
        reconfiguration = reconfigure.Reconfigure(branch.bzrdir)
150
152
        self.assertEqual('http://parent',
151
153
                         reconfiguration._select_bind_location())
152
154
        branch.set_push_location('sftp://push')
 
155
        reconfiguration = reconfigure.Reconfigure(branch.bzrdir)
153
156
        self.assertEqual('sftp://push',
154
157
                         reconfiguration._select_bind_location())
155
 
        branch.set_bound_location('bzr://foo/old-bound')
156
 
        branch.set_bound_location(None)
 
158
        branch.lock_write()
 
159
        try:
 
160
            branch.set_bound_location('bzr://foo/old-bound')
 
161
            branch.set_bound_location(None)
 
162
        finally:
 
163
            branch.unlock()
 
164
        reconfiguration = reconfigure.Reconfigure(branch.bzrdir)
157
165
        self.assertEqual('bzr://foo/old-bound',
158
166
                         reconfiguration._select_bind_location())
159
167
        branch.set_bound_location('bzr://foo/cur-bound')
 
168
        reconfiguration = reconfigure.Reconfigure(branch.bzrdir)
160
169
        self.assertEqual('bzr://foo/cur-bound',
161
170
                         reconfiguration._select_bind_location())
162
171
        reconfiguration.new_bound_location = 'ftp://user-specified'
180
189
        self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
181
190
        # setting a parent allows it to become a checkout
182
191
        tree.branch.set_parent(parent.base)
 
192
        reconfiguration = reconfigure.Reconfigure.to_checkout(tree.bzrdir)
183
193
        reconfiguration.apply()
184
194
        # supplying a location allows it to become a checkout
185
195
        tree2 = self.make_branch_and_tree('tree2')
198
208
        self.assertRaises(errors.NoBindLocation, reconfiguration.apply)
199
209
        # setting a parent allows it to become a checkout
200
210
        tree.branch.set_parent(parent.base)
 
211
        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
 
212
            tree.bzrdir)
201
213
        reconfiguration.apply()
202
214
        # supplying a location allows it to become a checkout
203
215
        tree2 = self.make_branch_and_tree('tree2')