~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-06 22:44:57 UTC
  • mfrom: (6436 +trunk)
  • mto: (6437.3.11 2.5)
  • mto: This revision was merged to the branch mainline in revision 6444.
  • Revision ID: jelmer@samba.org-20120106224457-re0pcy0fz31xob77
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Server-side bzrdir related request implmentations."""
18
18
 
 
19
from __future__ import absolute_import
19
20
 
20
21
from bzrlib import branch, errors, repository, urlutils
21
22
from bzrlib.bzrdir import (
208
209
            branch_name))
209
210
 
210
211
 
 
212
class SmartServerBzrDirRequestCheckoutMetaDir(SmartServerRequestBzrDir):
 
213
    """Get the format to use for checkouts.
 
214
 
 
215
    New in 2.5.
 
216
 
 
217
    :return: on success, a 3-tuple of network names for (control,
 
218
        repository, branch) directories, where '' signifies "not present".
 
219
        If this BzrDir contains a branch reference then this will fail with
 
220
        BranchReference; clients should resolve branch references before
 
221
        calling this RPC (they should not try to create a checkout of a
 
222
        checkout).
 
223
    """
 
224
 
 
225
    def do_bzrdir_request(self):
 
226
        try:
 
227
            branch_ref = self._bzrdir.get_branch_reference()
 
228
        except errors.NotBranchError:
 
229
            branch_ref = None
 
230
        if branch_ref is not None:
 
231
            # The server shouldn't try to resolve references, and it quite
 
232
            # possibly can't reach them anyway.  The client needs to resolve
 
233
            # the branch reference to determine the cloning_metadir.
 
234
            return FailedSmartServerResponse(('BranchReference',))
 
235
        control_format = self._bzrdir.checkout_metadir()
 
236
        control_name = control_format.network_name()
 
237
        if not control_format.fixed_components:
 
238
            branch_name = control_format.get_branch_format().network_name()
 
239
            repo_name = control_format.repository_format.network_name()
 
240
        else:
 
241
            branch_name = ''
 
242
            repo_name = ''
 
243
        return SuccessfulSmartServerResponse(
 
244
            (control_name, repo_name, branch_name))
 
245
 
 
246
 
211
247
class SmartServerRequestCreateBranch(SmartServerRequestBzrDir):
212
248
 
213
249
    def do(self, path, network_name):