~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Robert Collins
  • Date: 2006-02-14 11:23:07 UTC
  • mto: (1534.5.2 bzr-dir)
  • mto: This revision was merged to the branch mainline in revision 1554.
  • Revision ID: robertc@robertcollins.net-20060214112307-824f0b126b3c70a9
sprouting into shared repositories

Show diffs side-by-side

added added

removed removed

Lines of Context:
395
395
        """
396
396
        raise NotImplementedError(self.open_workingtree)
397
397
 
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
400
400
        development.
401
401
 
420
420
            try:
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:
 
426
        if force_new_repo:
 
427
            result_repo = None
 
428
        else:
 
429
            try:
 
430
                result_repo = result.find_repository()
 
431
            except errors.NoRepositoryPresent:
 
432
                result_repo = None
 
433
        if source_repository is None and result_repo is not None:
 
434
            pass
 
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)
429
443
        else:
430
 
            # no repo available, make a new one
431
 
            result.create_repository()
 
444
            # fetch needed content into target.
 
445
            if basis_repo:
 
446
                # XXX FIXME RBC 20060214 need tests for this when the basis
 
447
                # is incomplete
 
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)
434
452
        else: