~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-04-27 06:47:50 UTC
  • mfrom: (4294.2.12 push.roundtrips)
  • Revision ID: pqm@pqm.ubuntu.com-20090427064750-e9obd6h83omt86ps
(robertc) Reduce roundtrips needed to push a new branch by coalescing
        many steps of the initialisation process. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1162
1162
        return format
1163
1163
 
1164
1164
    def create_clone_on_transport(self, to_transport, revision_id=None,
1165
 
        stacked_on=None):
 
1165
        stacked_on=None, create_prefix=False, use_existing_dir=False):
1166
1166
        """Create a clone of this branch and its bzrdir.
1167
1167
 
1168
1168
        :param to_transport: The transport to clone onto.
1169
1169
        :param revision_id: The revision id to use as tip in the new branch.
1170
1170
            If None the tip is obtained from this branch.
1171
1171
        :param stacked_on: An optional URL to stack the clone on.
 
1172
        :param create_prefix: Create any missing directories leading up to
 
1173
            to_transport.
 
1174
        :param use_existing_dir: Use an existing directory if one exists.
1172
1175
        """
1173
1176
        # XXX: Fix the bzrdir API to allow getting the branch back from the
1174
1177
        # clone call. Or something. 20090224 RBC/spiv.
1175
 
        dir_to = self.bzrdir.clone_on_transport(to_transport,
1176
 
            revision_id=revision_id, stacked_on=stacked_on)
 
1178
        if revision_id is None:
 
1179
            revision_id = self.last_revision()
 
1180
        try:
 
1181
            dir_to = self.bzrdir.clone_on_transport(to_transport,
 
1182
                revision_id=revision_id, stacked_on=stacked_on,
 
1183
                create_prefix=create_prefix, use_existing_dir=use_existing_dir)
 
1184
        except errors.FileExists:
 
1185
            if not use_existing_dir:
 
1186
                raise
 
1187
        except errors.NoSuchFile:
 
1188
            if not create_prefix:
 
1189
                raise
1177
1190
        return dir_to.open_branch()
1178
1191
 
1179
1192
    def create_checkout(self, to_location, revision_id=None,