396
396
raise NotImplementedError(self.open_workingtree)
398
def sprout(self, url, revision_id=None, basis=None):
398
def sprout(self, url, revision_id=None, basis=None, force_new_repo=False):
399
399
"""Create a copy of this bzrdir prepared for use as a new line of
421
421
source_repository = self.open_repository()
422
422
except errors.NoRepositoryPresent:
423
# copy the basis one if there is one
423
# copy the entire basis one if there is one
424
# but there is no repository.
424
425
source_repository = basis_repo
425
if source_repository is not None:
430
result_repo = result.find_repository()
431
except errors.NoRepositoryPresent:
433
if source_repository is None and result_repo is not None:
435
elif source_repository is None and result_repo is None:
436
# no repo available, make a new one
437
result.create_repository()
438
elif source_repository is not None and result_repo is None:
439
# have soure, and want to make a new target repo
426
440
source_repository.clone(result,
427
441
revision_id=revision_id,
428
442
basis=basis_repo)
430
# no repo available, make a new one
431
result.create_repository()
444
# fetch needed content into target.
446
# XXX FIXME RBC 20060214 need tests for this when the basis
448
result_repo.fetch(basis_repo, revision_id=revision_id)
449
result_repo.fetch(source_repository, revision_id=revision_id)
432
450
if source_branch is not None:
433
451
source_branch.sprout(result, revision_id=revision_id)