325
330
return SuccessfulSmartServerResponse(('ok', ))
333
class SmartServerRequestBzrDirInitializeEx(SmartServerRequestBzrDir):
335
def parse_NoneTrueFalse(self, arg):
342
raise AssertionError("invalid arg %r" % arg)
344
def parse_NoneString(self, arg):
347
def _serialize_NoneTrueFalse(self, arg):
354
def do(self, bzrdir_network_name, path, use_existing_dir, create_prefix,
355
force_new_repo, stacked_on, stack_on_pwd, repo_format_name,
356
make_working_trees, shared_repo):
357
"""Initialize a bzrdir at path as per BzrDirFormat.initialize_ex
359
:return: SmartServerResponse()
361
target_transport = self.transport_from_client_path(path)
362
format = network_format_registry.get(bzrdir_network_name)
363
use_existing_dir = self.parse_NoneTrueFalse(use_existing_dir)
364
create_prefix = self.parse_NoneTrueFalse(create_prefix)
365
force_new_repo = self.parse_NoneTrueFalse(force_new_repo)
366
stacked_on = self.parse_NoneString(stacked_on)
367
stack_on_pwd = self.parse_NoneString(stack_on_pwd)
368
make_working_trees = self.parse_NoneTrueFalse(make_working_trees)
369
shared_repo = self.parse_NoneTrueFalse(shared_repo)
370
if stack_on_pwd == '.':
371
stack_on_pwd = target_transport.base
372
repo_format_name = self.parse_NoneString(repo_format_name)
373
repo, bzrdir, stacking, repository_policy = \
374
format.initialize_on_transport_ex(target_transport,
375
use_existing_dir=use_existing_dir, create_prefix=create_prefix,
376
force_new_repo=force_new_repo, stacked_on=stacked_on,
377
stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
378
make_working_trees=make_working_trees, shared_repo=shared_repo)
382
rich_root = tree_ref = external_lookup = ''
383
repo_bzrdir_name = ''
385
final_stack_pwd = None
387
repo_path = self._repo_relpath(bzrdir.root_transport, repo)
390
rich_root, tree_ref, external_lookup = self._format_to_capabilities(
392
repo_name = repo._format.network_name()
393
repo_bzrdir_name = repo.bzrdir._format.network_name()
394
final_stack = repository_policy._stack_on
395
final_stack_pwd = repository_policy._stack_on_pwd
396
final_stack = final_stack or ''
397
final_stack_pwd = final_stack_pwd or ''
398
return SuccessfulSmartServerResponse((repo_path, rich_root, tree_ref,
399
external_lookup, repo_name, repo_bzrdir_name,
400
bzrdir._format.network_name(),
401
self._serialize_NoneTrueFalse(stacking), final_stack,
328
405
class SmartServerRequestOpenBranch(SmartServerRequestBzrDir):
330
407
def do_bzrdir_request(self):