~bzr-pqm/bzr/bzr.dev

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
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
16
17
"""Reconfigure a bzrdir into a new tree/branch/repository layout"""
18
19
from bzrlib import (
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
20
    branch,
3311.2.1 by Aaron Bentley
Initial make-sharing functionality
21
    bzrdir,
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
22
    errors,
23
    )
24
25
class Reconfigure(object):
26
3983.3.2 by Marius Kruger
make changes directly in set_repository_trees()
27
    def __init__(self, bzrdir, new_bound_location=None):
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
28
        self.bzrdir = bzrdir
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
29
        self.new_bound_location = new_bound_location
4509.1.1 by Jelmer Vernooij
Fix for unbound variable in reconfiguring lightweight checkout
30
        self.local_repository = None
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
31
        try:
2796.2.10 by Aaron Bentley
Ensure that shared repositories are used where possible
32
            self.repository = self.bzrdir.find_repository()
2796.2.7 by Aaron Bentley
Implement converting a lightweight checkout to a branch
33
        except errors.NoRepositoryPresent:
34
            self.repository = None
4324.2.1 by Jelmer Vernooij
Make sure class member local_repository of reconfigure is initialized.
35
            self.local_repository = None
3311.2.2 by Aaron Bentley
Flesh out to_sharing
36
        else:
37
            if (self.repository.bzrdir.root_transport.base ==
38
                self.bzrdir.root_transport.base):
39
                self.local_repository = self.repository
40
            else:
41
                self.local_repository = None
2796.2.7 by Aaron Bentley
Implement converting a lightweight checkout to a branch
42
        try:
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
43
            branch = self.bzrdir.open_branch()
44
            if branch.bzrdir.root_transport.base == bzrdir.root_transport.base:
45
                self.local_branch = branch
46
                self.referenced_branch = None
47
            else:
48
                self.local_branch = None
49
                self.referenced_branch = branch
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
50
        except errors.NotBranchError:
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
51
            self.local_branch = None
2796.2.9 by Aaron Bentley
Ensure conversion from lightweight checkout works
52
            self.referenced_branch = None
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
53
        try:
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
54
            self.tree = bzrdir.open_workingtree()
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
55
        except errors.NoWorkingTree:
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
56
            self.tree = None
2796.2.14 by Aaron Bentley
Updates from review
57
        self._unbind = False
58
        self._bind = False
59
        self._destroy_reference = False
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
60
        self._create_reference = False
61
        self._destroy_branch = False
2796.2.14 by Aaron Bentley
Updates from review
62
        self._create_branch = False
63
        self._destroy_tree = False
64
        self._create_tree = False
65
        self._create_repository = False
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
66
        self._destroy_repository = False
3983.3.7 by Marius Kruger
apply changes in apply again
67
        self._repository_trees = None
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
68
69
    @staticmethod
70
    def to_branch(bzrdir):
2796.2.16 by Aaron Bentley
Documentation updates from review
71
        """Return a Reconfiguration to convert this bzrdir into a branch
72
73
        :param bzrdir: The bzrdir to reconfigure
74
        :raise errors.AlreadyBranch: if bzrdir is already a branch
75
        """
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
76
        reconfiguration = Reconfigure(bzrdir)
2796.2.15 by Aaron Bentley
More updates from review
77
        reconfiguration._plan_changes(want_tree=False, want_branch=True,
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
78
                                      want_bound=False, want_reference=False)
2796.2.14 by Aaron Bentley
Updates from review
79
        if not reconfiguration.changes_planned():
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
80
            raise errors.AlreadyBranch(bzrdir)
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
81
        return reconfiguration
82
83
    @staticmethod
84
    def to_tree(bzrdir):
2796.2.16 by Aaron Bentley
Documentation updates from review
85
        """Return a Reconfiguration to convert this bzrdir into a tree
86
87
        :param bzrdir: The bzrdir to reconfigure
88
        :raise errors.AlreadyTree: if bzrdir is already a tree
89
        """
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
90
        reconfiguration = Reconfigure(bzrdir)
2796.2.15 by Aaron Bentley
More updates from review
91
        reconfiguration._plan_changes(want_tree=True, want_branch=True,
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
92
                                      want_bound=False, want_reference=False)
2796.2.14 by Aaron Bentley
Updates from review
93
        if not reconfiguration.changes_planned():
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
94
            raise errors.AlreadyTree(bzrdir)
95
        return reconfiguration
96
97
    @staticmethod
98
    def to_checkout(bzrdir, bound_location=None):
2796.2.16 by Aaron Bentley
Documentation updates from review
99
        """Return a Reconfiguration to convert this bzrdir into a checkout
100
101
        :param bzrdir: The bzrdir to reconfigure
102
        :param bound_location: The location the checkout should be bound to.
103
        :raise errors.AlreadyCheckout: if bzrdir is already a checkout
104
        """
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
105
        reconfiguration = Reconfigure(bzrdir, bound_location)
2796.2.15 by Aaron Bentley
More updates from review
106
        reconfiguration._plan_changes(want_tree=True, want_branch=True,
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
107
                                      want_bound=True, want_reference=False)
2796.2.14 by Aaron Bentley
Updates from review
108
        if not reconfiguration.changes_planned():
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
109
            raise errors.AlreadyCheckout(bzrdir)
110
        return reconfiguration
111
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
112
    @classmethod
113
    def to_lightweight_checkout(klass, bzrdir, reference_location=None):
114
        """Make a Reconfiguration to convert bzrdir into a lightweight checkout
115
116
        :param bzrdir: The bzrdir to reconfigure
117
        :param bound_location: The location the checkout should be bound to.
118
        :raise errors.AlreadyLightweightCheckout: if bzrdir is already a
119
            lightweight checkout
120
        """
121
        reconfiguration = klass(bzrdir, reference_location)
122
        reconfiguration._plan_changes(want_tree=True, want_branch=False,
123
                                      want_bound=False, want_reference=True)
124
        if not reconfiguration.changes_planned():
125
            raise errors.AlreadyLightweightCheckout(bzrdir)
126
        return reconfiguration
127
3311.2.1 by Aaron Bentley
Initial make-sharing functionality
128
    @classmethod
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
129
    def to_use_shared(klass, bzrdir):
130
        """Convert a standalone branch into a repository branch"""
3311.2.1 by Aaron Bentley
Initial make-sharing functionality
131
        reconfiguration = klass(bzrdir)
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
132
        reconfiguration._set_use_shared(use_shared=True)
3311.2.2 by Aaron Bentley
Flesh out to_sharing
133
        if not reconfiguration.changes_planned():
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
134
            raise errors.AlreadyUsingShared(bzrdir)
3311.2.1 by Aaron Bentley
Initial make-sharing functionality
135
        return reconfiguration
136
3311.2.4 by Aaron Bentley
Implement conversion to standalone
137
    @classmethod
138
    def to_standalone(klass, bzrdir):
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
139
        """Convert a repository branch into a standalone branch"""
3311.2.4 by Aaron Bentley
Implement conversion to standalone
140
        reconfiguration = klass(bzrdir)
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
141
        reconfiguration._set_use_shared(use_shared=False)
3311.2.4 by Aaron Bentley
Implement conversion to standalone
142
        if not reconfiguration.changes_planned():
143
            raise errors.AlreadyStandalone(bzrdir)
144
        return reconfiguration
145
3921.4.2 by Matthew Fuller
Add support in Reconfigure for manipulating the repository setting for
146
    @classmethod
147
    def set_repository_trees(klass, bzrdir, with_trees):
3983.3.2 by Marius Kruger
make changes directly in set_repository_trees()
148
        """Adjust a repository's working tree presence default"""
149
        reconfiguration = klass(bzrdir)
3921.4.10 by Matthew Fuller
Stop trying to use _plan_changes() wholesale and just move all the
150
        if not reconfiguration.repository.is_shared():
151
            raise errors.ReconfigurationNotSupported(reconfiguration.bzrdir)
3983.3.2 by Marius Kruger
make changes directly in set_repository_trees()
152
        if with_trees and reconfiguration.repository.make_working_trees():
153
            raise errors.AlreadyWithTrees(bzrdir)
3983.3.11 by Vincent Ladeuil
Fix indentation as per Aaron's review and then some.
154
        elif (not with_trees
155
              and not reconfiguration.repository.make_working_trees()):
3983.3.2 by Marius Kruger
make changes directly in set_repository_trees()
156
            raise errors.AlreadyWithNoTrees(bzrdir)
157
        else:
3983.3.7 by Marius Kruger
apply changes in apply again
158
            reconfiguration._repository_trees = with_trees
3921.4.2 by Matthew Fuller
Add support in Reconfigure for manipulating the repository setting for
159
        return reconfiguration
160
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
161
    def _plan_changes(self, want_tree, want_branch, want_bound,
3921.4.9 by Matthew Fuller
Back out _plan_changes() changes for trees frobbing. It's way more
162
                      want_reference):
2796.2.10 by Aaron Bentley
Ensure that shared repositories are used where possible
163
        """Determine which changes are needed to assume the configuration"""
3921.4.9 by Matthew Fuller
Back out _plan_changes() changes for trees frobbing. It's way more
164
        if not want_branch and not want_reference:
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
165
            raise errors.ReconfigurationNotSupported(self.bzrdir)
166
        if want_branch and want_reference:
167
            raise errors.ReconfigurationNotSupported(self.bzrdir)
2796.2.7 by Aaron Bentley
Implement converting a lightweight checkout to a branch
168
        if self.repository is None:
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
169
            if not want_reference:
170
                self._create_repository = True
171
        else:
172
            if want_reference and (self.repository.bzrdir.root_transport.base
173
                                   == self.bzrdir.root_transport.base):
2796.2.25 by Aaron Bentley
Avoid destroying shared repositories
174
                if not self.repository.is_shared():
175
                    self._destroy_repository = True
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
176
        if self.referenced_branch is None:
177
            if want_reference:
178
                self._create_reference = True
2796.2.31 by Aaron Bentley
Fetch tags to reference branch when converting to checkout
179
                if self.local_branch is not None:
180
                    self._destroy_branch = True
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
181
        else:
182
            if not want_reference:
183
                self._destroy_reference = True
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
184
        if self.local_branch is None:
2796.2.15 by Aaron Bentley
More updates from review
185
            if want_branch is True:
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
186
                self._create_branch = True
187
                if want_bound:
188
                    self._bind = True
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
189
        else:
2796.2.15 by Aaron Bentley
More updates from review
190
            if want_bound:
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
191
                if self.local_branch.get_bound_location() is None:
2796.2.14 by Aaron Bentley
Updates from review
192
                    self._bind = True
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
193
            else:
194
                if self.local_branch.get_bound_location() is not None:
2796.2.14 by Aaron Bentley
Updates from review
195
                    self._unbind = True
2796.2.15 by Aaron Bentley
More updates from review
196
        if not want_tree and self.tree is not None:
2796.2.14 by Aaron Bentley
Updates from review
197
            self._destroy_tree = True
2796.2.15 by Aaron Bentley
More updates from review
198
        if want_tree and self.tree is None:
2796.2.14 by Aaron Bentley
Updates from review
199
            self._create_tree = True
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
200
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
201
    def _set_use_shared(self, use_shared=None):
202
        if use_shared is None:
3311.2.1 by Aaron Bentley
Initial make-sharing functionality
203
            return
3311.2.6 by Aaron Bentley
rename 'sharing' to 'use-shared'
204
        if use_shared:
3311.2.2 by Aaron Bentley
Flesh out to_sharing
205
            if self.local_repository is not None:
206
                self._destroy_repository = True
3311.2.4 by Aaron Bentley
Implement conversion to standalone
207
        else:
208
            if self.local_repository is None:
209
                self._create_repository = True
3311.2.1 by Aaron Bentley
Initial make-sharing functionality
210
2796.2.14 by Aaron Bentley
Updates from review
211
    def changes_planned(self):
2796.2.11 by Aaron Bentley
Cleanups
212
        """Return True if changes are planned, False otherwise"""
2796.2.14 by Aaron Bentley
Updates from review
213
        return (self._unbind or self._bind or self._destroy_tree
214
                or self._create_tree or self._destroy_reference
2796.2.26 by Aaron Bentley
Support converting standalone tree to lightweight checkout
215
                or self._create_branch or self._create_repository
3983.3.5 by Marius Kruger
put bracket back where we found it
216
                or self._create_reference or self._destroy_repository)
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
217
218
    def _check(self):
2796.2.11 by Aaron Bentley
Cleanups
219
        """Raise if reconfiguration would destroy local changes"""
2796.2.14 by Aaron Bentley
Updates from review
220
        if self._destroy_tree:
4503.1.2 by Vincent Ladeuil
Use tree.has_changes() where appropriate (the test suite caught a
221
            # XXX: What about pending merges ? -- vila 20090629
222
            if self.tree.has_changes(self.tree.basis_tree()):
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
223
                raise errors.UncommittedChanges(self.tree)
3338.1.1 by Aaron Bentley
Raise an error when converting a branch to a lightweight checkout loses data
224
        if self._create_reference and self.local_branch is not None:
225
            reference_branch = branch.Branch.open(self._select_bind_location())
226
            if (reference_branch.last_revision() !=
227
                self.local_branch.last_revision()):
228
                raise errors.UnsyncedBranches(self.bzrdir, reference_branch)
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
229
230
    def _select_bind_location(self):
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
231
        """Select a location to bind or create a reference to.
2796.2.11 by Aaron Bentley
Cleanups
232
233
        Preference is:
234
        1. user specified location
235
        2. branch reference location (it's a kind of bind location)
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
236
        3. current bind location
237
        4. previous bind location (it was a good choice once)
238
        5. push location (it's writeable, so committable)
239
        6. parent location (it's pullable, so update-from-able)
2796.2.11 by Aaron Bentley
Cleanups
240
        """
241
        if self.new_bound_location is not None:
242
            return self.new_bound_location
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
243
        if self.local_branch is not None:
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
244
            bound = self.local_branch.get_bound_location()
245
            if bound is not None:
246
                return bound
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
247
            old_bound = self.local_branch.get_old_bound_location()
248
            if old_bound is not None:
249
                return old_bound
250
            push_location = self.local_branch.get_push_location()
251
            if push_location is not None:
252
                return push_location
253
            parent = self.local_branch.get_parent()
254
            if parent is not None:
255
                return parent
2796.2.9 by Aaron Bentley
Ensure conversion from lightweight checkout works
256
        elif self.referenced_branch is not None:
257
            return self.referenced_branch.base
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
258
        raise errors.NoBindLocation(self.bzrdir)
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
259
260
    def apply(self, force=False):
2796.2.16 by Aaron Bentley
Documentation updates from review
261
        """Apply the reconfiguration
262
263
        :param force: If true, the reconfiguration is applied even if it will
264
            destroy local changes.
265
        :raise errors.UncommittedChanges: if the local tree is to be destroyed
266
            but contains uncommitted changes.
267
        :raise errors.NoBindLocation: if no bind location was specified and
268
            none could be autodetected.
269
        """
2796.2.1 by Aaron Bentley
Begin work on reconfigure command
270
        if not force:
271
            self._check()
2796.2.14 by Aaron Bentley
Updates from review
272
        if self._create_repository:
4297.4.5 by Martin von Gagern
Use repository format from exactly the same repository we want to fetch from.
273
            if self.local_branch and not self._destroy_branch:
274
                old_repo = self.local_branch.repository
275
            elif self._create_branch and self.referenced_branch is not None:
276
                old_repo = self.referenced_branch.repository
277
            else:
278
                old_repo = None
279
            if old_repo is not None:
280
                repository_format = old_repo._format
281
            else:
282
                repository_format = None
4297.4.3 by Martin von Gagern
Cleaner implementation of reconfigure.
283
            if repository_format is not None:
284
                repo = repository_format.initialize(self.bzrdir)
285
            else:
286
                repo = self.bzrdir.create_repository()
3311.2.4 by Aaron Bentley
Implement conversion to standalone
287
            if self.local_branch and not self._destroy_branch:
288
                repo.fetch(self.local_branch.repository,
289
                           self.local_branch.last_revision())
2796.2.10 by Aaron Bentley
Ensure that shared repositories are used where possible
290
        else:
291
            repo = self.repository
2796.2.23 by Aaron Bentley
Add support for reconfiguring repositories into branches or trees
292
        if self._create_branch and self.referenced_branch is not None:
2796.2.10 by Aaron Bentley
Ensure that shared repositories are used where possible
293
            repo.fetch(self.referenced_branch.repository,
294
                       self.referenced_branch.last_revision())
2796.2.30 by Aaron Bentley
Reconfigure can safely be interrupted while fetching (#179316)
295
        if self._create_reference:
296
            reference_branch = branch.Branch.open(self._select_bind_location())
297
        if self._destroy_repository:
298
            if self._create_reference:
299
                reference_branch.repository.fetch(self.repository)
3311.2.1 by Aaron Bentley
Initial make-sharing functionality
300
            elif self.local_branch is not None and not self._destroy_branch:
301
                up = self.local_branch.bzrdir.root_transport.clone('..')
302
                up_bzrdir = bzrdir.BzrDir.open_containing_from_transport(up)[0]
303
                new_repo = up_bzrdir.find_repository()
304
                new_repo.fetch(self.repository)
2796.2.23 by Aaron Bentley
Add support for reconfiguring repositories into branches or trees
305
        last_revision_info = None
2796.2.14 by Aaron Bentley
Updates from review
306
        if self._destroy_reference:
2796.2.23 by Aaron Bentley
Add support for reconfiguring repositories into branches or trees
307
            last_revision_info = self.referenced_branch.last_revision_info()
2796.2.7 by Aaron Bentley
Implement converting a lightweight checkout to a branch
308
            self.bzrdir.destroy_branch()
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
309
        if self._destroy_branch:
2796.2.23 by Aaron Bentley
Add support for reconfiguring repositories into branches or trees
310
            last_revision_info = self.local_branch.last_revision_info()
2796.2.31 by Aaron Bentley
Fetch tags to reference branch when converting to checkout
311
            if self._create_reference:
312
                self.local_branch.tags.merge_to(reference_branch.tags)
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
313
            self.bzrdir.destroy_branch()
2796.2.14 by Aaron Bentley
Updates from review
314
        if self._create_branch:
2796.2.9 by Aaron Bentley
Ensure conversion from lightweight checkout works
315
            local_branch = self.bzrdir.create_branch()
2796.2.23 by Aaron Bentley
Add support for reconfiguring repositories into branches or trees
316
            if last_revision_info is not None:
317
                local_branch.set_last_revision_info(*last_revision_info)
2796.2.32 by Aaron Bentley
Preserve tags converting from lightweight checkouts
318
            if self._destroy_reference:
319
                self.referenced_branch.tags.merge_to(local_branch.tags)
4273.1.18 by Aaron Bentley
Reconfigure preserves reference locations.
320
                self.referenced_branch.update_references(local_branch)
2796.2.9 by Aaron Bentley
Ensure conversion from lightweight checkout works
321
        else:
322
            local_branch = self.local_branch
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
323
        if self._create_reference:
324
            format = branch.BranchReferenceFormat().initialize(self.bzrdir,
325
                reference_branch)
2796.2.14 by Aaron Bentley
Updates from review
326
        if self._destroy_tree:
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
327
            self.bzrdir.destroy_workingtree()
2796.2.14 by Aaron Bentley
Updates from review
328
        if self._create_tree:
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
329
            self.bzrdir.create_workingtree()
2796.2.14 by Aaron Bentley
Updates from review
330
        if self._unbind:
2796.2.3 by Aaron Bentley
Implement conversion to tree and checkout
331
            self.local_branch.unbind()
2796.2.14 by Aaron Bentley
Updates from review
332
        if self._bind:
2796.2.11 by Aaron Bentley
Cleanups
333
            bind_location = self._select_bind_location()
2796.2.9 by Aaron Bentley
Ensure conversion from lightweight checkout works
334
            local_branch.bind(branch.Branch.open(bind_location))
2796.2.19 by Aaron Bentley
Support reconfigure --lightweight-checkout
335
        if self._destroy_repository:
336
            self.bzrdir.destroy_repository()
3983.3.7 by Marius Kruger
apply changes in apply again
337
        if self._repository_trees is not None:
338
            repo.set_make_working_trees(self._repository_trees)