133
133
if self.referenced_branch is None:
134
134
if want_reference:
135
135
self._create_reference = True
136
if self.local_branch is not None:
137
self._destroy_branch = True
137
139
if not want_reference:
138
140
self._destroy_reference = True
216
218
if self._create_branch and self.referenced_branch is not None:
217
219
repo.fetch(self.referenced_branch.repository,
218
220
self.referenced_branch.last_revision())
221
if self._create_reference:
222
reference_branch = branch.Branch.open(self._select_bind_location())
223
if self._destroy_repository:
224
if self._create_reference:
225
reference_branch.repository.fetch(self.repository)
219
226
last_revision_info = None
220
227
if self._destroy_reference:
221
228
last_revision_info = self.referenced_branch.last_revision_info()
222
229
self.bzrdir.destroy_branch()
223
230
if self._destroy_branch:
224
231
last_revision_info = self.local_branch.last_revision_info()
232
if self._create_reference:
233
self.local_branch.tags.merge_to(reference_branch.tags)
225
234
self.bzrdir.destroy_branch()
226
235
if self._create_branch:
227
236
local_branch = self.bzrdir.create_branch()
228
237
if last_revision_info is not None:
229
238
local_branch.set_last_revision_info(*last_revision_info)
239
if self._destroy_reference:
240
self.referenced_branch.tags.merge_to(local_branch.tags)
231
242
local_branch = self.local_branch
232
243
if self._create_reference:
233
reference_branch = branch.Branch.open(self._select_bind_location())
234
244
format = branch.BranchReferenceFormat().initialize(self.bzrdir,
235
245
reference_branch)
236
246
if self._destroy_tree:
243
253
bind_location = self._select_bind_location()
244
254
local_branch.bind(branch.Branch.open(bind_location))
245
255
if self._destroy_repository:
246
if self._create_reference:
247
reference_branch.repository.fetch(self.repository)
248
256
self.bzrdir.destroy_repository()