~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Jelmer Vernooij
  • Date: 2011-11-04 23:59:40 UTC
  • mto: This revision was merged to the branch mainline in revision 6276.
  • Revision ID: jelmer@samba.org-20111104235940-mfapnf7wgmfmgdl2
support creating new colocated branches from 'bzr switch -b'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6068
6068
            if '/' not in to_location and '\\' not in to_location:
6069
6069
                # This path is meant to be relative to the existing branch
6070
6070
                this_url = self._get_branch_location(control_dir)
6071
 
                to_location = urlutils.join(this_url, '..', to_location)
 
6071
                # Perhaps the target control dir supports colocated branches?
 
6072
                try:
 
6073
                    root = controldir.ControlDir.open(this_url,
 
6074
                        possible_transports=[control_dir.user_transport])
 
6075
                except errors.NotBranchError:
 
6076
                    colocated = False
 
6077
                else:
 
6078
                    colocated = root._format.colocated_branches
 
6079
                if colocated:
 
6080
                    to_location = urlutils.join_segment_parameters(this_url,
 
6081
                        {"branch": to_location.encode("utf-8")})
 
6082
                else:
 
6083
                    to_location = urlutils.join(this_url, '..', to_location)
6072
6084
            to_branch = branch.bzrdir.sprout(to_location,
6073
6085
                                 possible_transports=[branch.bzrdir.root_transport],
6074
6086
                                 source_branch=branch).open_branch()