~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/bzrdir.py

(jelmer) Add HPSS call for ``BzrDir.checkout_metadir``. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

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