3020
3022
self._supply_sub_formats_to(format)
3021
3023
return remote.RemoteBzrDir(transport, format)
3025
def _serialize_NoneTrueFalse(self, arg):
3032
def initialize_on_transport_ex(self, transport, use_existing_dir=False,
3033
create_prefix=False, force_new_repo=False, stacked_on=None,
3034
stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
3037
# hand off the request to the smart server
3038
client_medium = transport.get_smart_medium()
3039
except errors.NoSmartMedium:
3040
# TODO: lookup the local format from a server hint.
3041
local_dir_format = BzrDirMetaFormat1()
3042
self._supply_sub_formats_to(local_dir_format)
3043
return local_dir_format.initialize_on_transport_ex(transport,
3044
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
3045
force_new_repo=force_new_repo, stacked_on=stacked_on,
3046
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
3047
make_working_trees=make_working_trees, shared_repo=shared_repo)
3048
client = _SmartClient(client_medium)
3049
path = client.remote_path_from_transport(transport)
3050
if client_medium._is_remote_before((1, 15)):
3051
local_dir_format = BzrDirMetaFormat1()
3052
self._supply_sub_formats_to(local_dir_format)
3053
return local_dir_format.initialize_on_transport_ex(transport,
3054
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
3055
force_new_repo=force_new_repo, stacked_on=stacked_on,
3056
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
3057
make_working_trees=make_working_trees, shared_repo=shared_repo)
3058
if not (create_prefix is False and force_new_repo is False and
3059
stacked_on is None and stack_on_pwd is None and repo_format_name is
3060
None and make_working_trees is None and shared_repo is False):
3061
local_dir_format = BzrDirMetaFormat1()
3062
self._supply_sub_formats_to(local_dir_format)
3063
return local_dir_format.initialize_on_transport_ex(transport,
3064
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
3065
force_new_repo=force_new_repo, stacked_on=stacked_on,
3066
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
3067
make_working_trees=make_working_trees, shared_repo=shared_repo)
3069
args.append(self._serialize_NoneTrueFalse(use_existing_dir))
3071
response = client.call('BzrDirFormat.initialize_ex', path, *args)
3072
except errors.UnknownSmartMethod:
3073
local_dir_format = BzrDirMetaFormat1()
3074
self._supply_sub_formats_to(local_dir_format)
3075
return local_dir_format.initialize_on_transport_ex(transport,
3076
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
3077
force_new_repo=force_new_repo, stacked_on=stacked_on,
3078
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
3079
make_working_trees=make_working_trees, shared_repo=shared_repo)
3080
format = RemoteBzrDirFormat()
3081
self._supply_sub_formats_to(format)
3082
return None, remote.RemoteBzrDir(transport, format), None, None
3023
3084
def _open(self, transport):
3024
3085
return remote.RemoteBzrDir(transport, self)