1062
1062
def sprout(self, url, revision_id=None, force_new_repo=False,
1063
1063
recurse='down', possible_transports=None,
1064
accelerator_tree=None, hardlink=False, stacked=False):
1064
accelerator_tree=None, hardlink=False, stacked=False,
1065
source_branch=None):
1065
1066
"""Create a copy of this bzrdir prepared for use as a new line of
1088
1089
cloning_format = self.cloning_metadir(stacked)
1089
1090
# Create/update the result branch
1090
1091
result = cloning_format.initialize_on_transport(target_transport)
1092
source_branch = self.open_branch()
1093
source_repository = source_branch.repository
1092
# if a stacked branch wasn't requested, we don't create one
1093
# even if the origin was stacked
1094
stacked_branch_url = None
1095
if source_branch is not None:
1095
1097
stacked_branch_url = self.root_transport.base
1097
# if a stacked branch wasn't requested, we don't create one
1098
# even if the origin was stacked
1099
stacked_branch_url = None
1100
except errors.NotBranchError:
1101
source_branch = None
1098
source_repository = source_branch.repository
1103
source_repository = self.open_repository()
1104
except errors.NoRepositoryPresent:
1105
source_repository = None
1106
stacked_branch_url = None
1101
source_branch = self.open_branch()
1102
source_repository = source_branch.repository
1104
stacked_branch_url = self.root_transport.base
1105
except errors.NotBranchError:
1106
source_branch = None
1108
source_repository = self.open_repository()
1109
except errors.NoRepositoryPresent:
1110
source_repository = None
1107
1111
repository_policy = result.determine_repository_policy(
1108
1112
force_new_repo, stacked_branch_url, require_stacking=stacked)
1109
1113
result_repo = repository_policy.acquire_repository()
2647
2651
return self.get_format_description() == other.get_format_description()
2654
def repository_format(self):
2655
# Using a property to avoid early loading of remote
2656
return remote.RemoteRepositoryFormat()
2650
2659
BzrDirFormat.register_control_server_format(RemoteBzrDirFormat)