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