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