74
74
transport.mkdir('.')
77
def redirected(redirected_transport, e, redirection_notice):
78
return transport.get_transport(e.get_target_url())
77
def redirected(transport, e, redirection_notice):
78
note(redirection_notice)
79
return transport._redirected_to(e.source, e.target)
81
82
to_transport = transport.do_catching_redirections(
101
102
# Now the target directory exists, but doesn't have a .bzr
102
103
# directory. So we need to create it, along with any work to create
103
104
# 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)
105
dir_to = br_from.bzrdir.clone_on_transport(to_transport,
106
revision_id=revision_id, stacked_on=stacked_on)
123
107
br_to = dir_to.open_branch()
124
108
# 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)
110
finally_stacked_on = br_to.get_stacked_on_url()
111
except (errors.UnstackableBranchFormat,
112
errors.UnstackableRepositoryFormat,
114
finally_stacked_on = None
115
if finally_stacked_on is not None:
116
note('Created new stacked branch referring to %s.' %
128
119
note('Created new branch.')
129
120
# We successfully created the target, remember it