1317
1317
'already exists.') % to_location)
1320
bzrdir.BzrDir.open_from_transport(to_transport)
1320
to_dir = bzrdir.BzrDir.open_from_transport(to_transport)
1321
1321
except errors.NotBranchError:
1324
raise errors.AlreadyBranchError(to_location)
1325
to_dir.open_branch()
1326
except errors.NotBranchError:
1329
raise errors.AlreadyBranchError(to_location)
1325
1330
except errors.NoSuchFile:
1326
1331
raise errors.BzrCommandError(gettext('Parent of "%s" does not exist.')
1329
# preserve whatever source format we have.
1330
dir = br_from.bzrdir.sprout(to_transport.base, revision_id,
1331
possible_transports=[to_transport],
1332
accelerator_tree=accelerator_tree,
1333
hardlink=hardlink, stacked=stacked,
1334
force_new_repo=standalone,
1335
create_tree_if_local=not no_tree,
1336
source_branch=br_from)
1337
branch = dir.open_branch()
1338
except errors.NoSuchRevision:
1339
to_transport.delete_tree('.')
1340
msg = gettext("The branch {0} has no revision {1}.").format(
1341
from_location, revision)
1342
raise errors.BzrCommandError(msg)
1337
# preserve whatever source format we have.
1338
to_dir = br_from.bzrdir.sprout(to_transport.base, revision_id,
1339
possible_transports=[to_transport],
1340
accelerator_tree=accelerator_tree,
1341
hardlink=hardlink, stacked=stacked,
1342
force_new_repo=standalone,
1343
create_tree_if_local=not no_tree,
1344
source_branch=br_from)
1345
branch = to_dir.open_branch()
1346
except errors.NoSuchRevision:
1347
to_transport.delete_tree('.')
1348
msg = gettext("The branch {0} has no revision {1}.").format(
1349
from_location, revision)
1350
raise errors.BzrCommandError(msg)
1352
branch = br_from.sprout(to_dir, revision_id=revision_id)
1343
1353
_merge_tags_if_possible(br_from, branch)
1344
1354
# If the source branch is stacked, the new branch may
1345
1355
# be stacked whether we asked for that explicitly or not.