~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-02-25 05:15:39 UTC
  • mfrom: (4044.1.3 push.roundtrips)
  • Revision ID: pqm@pqm.ubuntu.com-20090225051539-61fkvmey7t598fzs
(robertc) Create a clean method for cloning a branch and optimise the
        specific case of clone-to-RemoteBranch to avoid round trips
        reopening a branch we just created. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
916
916
    def clone(self, to_bzrdir, revision_id=None):
917
917
        """Clone this branch into to_bzrdir preserving all semantic values.
918
918
 
 
919
        Most API users will want 'create_clone_on_transport', which creates a
 
920
        new bzrdir and branch on the fly.
 
921
 
919
922
        revision_id: if not None, the revision history in the new branch will
920
923
                     be truncated to end with revision_id.
921
924
        """
1036
1039
            format.set_branch_format(self._format)
1037
1040
        return format
1038
1041
 
 
1042
    def create_clone_on_transport(self, to_transport, revision_id=None,
 
1043
        stacked_on=None):
 
1044
        """Create a clone of this branch and its bzrdir.
 
1045
 
 
1046
        :param to_transport: The transport to clone onto.
 
1047
        :param revision_id: The revision id to use as tip in the new branch.
 
1048
            If None the tip is obtained from this branch.
 
1049
        :param stacked_on: An optional URL to stack the clone on.
 
1050
        """
 
1051
        # XXX: Fix the bzrdir API to allow getting the branch back from the
 
1052
        # clone call. Or something. 20090224 RBC/spiv.
 
1053
        dir_to = self.bzrdir.clone_on_transport(to_transport,
 
1054
            revision_id=revision_id, stacked_on=stacked_on)
 
1055
        return dir_to.open_branch()
 
1056
 
1039
1057
    def create_checkout(self, to_location, revision_id=None,
1040
1058
                        lightweight=False, accelerator_tree=None,
1041
1059
                        hardlink=False):