/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Andrew Bennetts
  • Date: 2008-04-07 10:34:57 UTC
  • mfrom: (3344 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3349.
  • Revision ID: andrew.bennetts@canonical.com-20080407103457-ro4t95pd3imwt0zw
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2394
2394
    def probe_transport(klass, transport):
2395
2395
        """Return a RemoteBzrDirFormat object if it looks possible."""
2396
2396
        try:
2397
 
            client = transport.get_smart_client()
 
2397
            medium = transport.get_smart_medium()
2398
2398
        except (NotImplementedError, AttributeError,
2399
 
                errors.TransportNotPossible):
 
2399
                errors.TransportNotPossible, errors.NoSmartMedium):
2400
2400
            # no smart server, so not a branch for this format type.
2401
2401
            raise errors.NotBranchError(path=transport.base)
2402
2402
        else:
2403
 
            # Send a 'hello' request in protocol version one, and decline to
2404
 
            # open it if the server doesn't support our required version (2) so
2405
 
            # that the VFS-based transport will do it.
2406
 
            request = client.get_request()
2407
 
            smart_protocol = protocol.SmartClientRequestProtocolOne(request)
2408
 
            server_version = smart_protocol.query_version()
 
2403
            # Decline to open it if the server doesn't support our required
 
2404
            # version (2) so that the VFS-based transport will do it.
 
2405
            try:
 
2406
                server_version = medium.protocol_version()
 
2407
            except errors.SmartProtocolError:
 
2408
                # Apparently there's no usable smart server there, even though
 
2409
                # the medium supports the smart protocol.
 
2410
                raise errors.NotBranchError(path=transport.base)
2409
2411
            if server_version != 2:
2410
2412
                raise errors.NotBranchError(path=transport.base)
2411
2413
            return klass()
2413
2415
    def initialize_on_transport(self, transport):
2414
2416
        try:
2415
2417
            # hand off the request to the smart server
2416
 
            shared_medium = transport.get_shared_medium()
 
2418
            client_medium = transport.get_smart_medium()
2417
2419
        except errors.NoSmartMedium:
2418
2420
            # TODO: lookup the local format from a server hint.
2419
2421
            local_dir_format = BzrDirMetaFormat1()
2420
2422
            return local_dir_format.initialize_on_transport(transport)
2421
 
        client = _SmartClient(shared_medium)
 
2423
        client = _SmartClient(client_medium, transport.base)
2422
2424
        path = client.remote_path_from_transport(transport)
2423
 
        response = _SmartClient(shared_medium).call('BzrDirFormat.initialize',
2424
 
                                                    path)
 
2425
        response = client.call('BzrDirFormat.initialize', path)
2425
2426
        assert response[0] in ('ok', ), 'unexpected response code %s' % (response,)
2426
2427
        return remote.RemoteBzrDir(transport)
2427
2428