~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Aaron Bentley
  • Date: 2008-12-02 04:24:59 UTC
  • mfrom: (3878 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3893.
  • Revision ID: aaron@aaronbentley.com-20081202042459-y0y1n73u7jwqpgeq
Merge bzr.dev into ls-shelf

Show diffs side-by-side

added added

removed removed

Lines of Context:
1061
1061
 
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
1066
1067
        development.
1067
1068
 
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)
1091
 
        try:
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:
1094
1096
            if stacked:
1095
1097
                stacked_branch_url = self.root_transport.base
1096
 
            else:
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
 
1099
        else:
1102
1100
            try:
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
 
1103
                if stacked:
 
1104
                    stacked_branch_url = self.root_transport.base
 
1105
            except errors.NotBranchError:
 
1106
                source_branch = None
 
1107
                try:
 
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()
2646
2650
            return False
2647
2651
        return self.get_format_description() == other.get_format_description()
2648
2652
 
 
2653
    @property
 
2654
    def repository_format(self):
 
2655
        # Using a property to avoid early loading of remote
 
2656
        return remote.RemoteRepositoryFormat()
 
2657
 
2649
2658
 
2650
2659
BzrDirFormat.register_control_server_format(RemoteBzrDirFormat)
2651
2660