101
101
# Now the target directory exists, but doesn't have a .bzr
102
102
# directory. So we need to create it, along with any work to create
103
103
# all of the dependent branches, etc.
104
if stacked_on is not None:
105
# This should be buried in the clone method itself. TODO.
107
# if the from format is stackable, this will either work or
108
# trigger NotStacked. If it's not, an error will be given to
110
br_from.get_stacked_on_url()
111
except errors.NotStacked:
113
# now we need to sprout the repository,
114
dir_to = br_from.bzrdir._format.initialize_on_transport(to_transport)
115
br_from.repository._format.initialize(dir_to)
116
br_to = br_from._format.initialize(dir_to)
117
br_to.set_stacked_on_url(stacked_on)
118
# and copy the data up.
121
dir_to = br_from.bzrdir.clone_on_transport(to_transport,
122
revision_id=revision_id)
104
dir_to = br_from.bzrdir.clone_on_transport(to_transport,
105
revision_id=revision_id, stacked_on=stacked_on)
123
106
br_to = dir_to.open_branch()
124
107
# TODO: Some more useful message about what was copied
125
if stacked_on is not None:
126
note('Created new stacked branch referring to %s.' % stacked_on)
109
finally_stacked_on = br_to.get_stacked_on_url()
110
except (errors.UnstackableBranchFormat,
111
errors.UnstackableRepositoryFormat,
113
finally_stacked_on = None
114
if finally_stacked_on is not None:
115
note('Created new stacked branch referring to %s.' %
128
118
note('Created new branch.')
129
119
# We successfully created the target, remember it