/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: Robert Collins
  • Date: 2008-04-04 00:43:07 UTC
  • mfrom: (3331 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3333.
  • Revision ID: robertc@robertcollins.net-20080404004307-0whomfhm3yal2rvw
Resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1436
1436
        try:
1437
1437
            return klass._formats[format_string]
1438
1438
        except KeyError:
1439
 
            raise errors.UnknownFormatError(format=format_string)
 
1439
            raise errors.UnknownFormatError(format=format_string, kind='bzrdir')
1440
1440
 
1441
1441
    @classmethod
1442
1442
    def get_default_format(klass):
1491
1491
        mutter('created control directory in ' + transport.base)
1492
1492
        control = transport.clone('.bzr')
1493
1493
        utf8_files = [('README', 
1494
 
                       "This is a Bazaar-NG control directory.\n"
1495
 
                       "Do not change any files in this directory.\n"),
 
1494
                       "This is a Bazaar control directory.\n"
 
1495
                       "Do not change any files in this directory.\n"
 
1496
                       "See http://bazaar-vcs.org/ for more information about Bazaar.\n"),
1496
1497
                      ('branch-format', self.get_format_string()),
1497
1498
                      ]
1498
1499
        # NB: no need to escape relative paths that are url safe.
2393
2394
    def probe_transport(klass, transport):
2394
2395
        """Return a RemoteBzrDirFormat object if it looks possible."""
2395
2396
        try:
2396
 
            client = transport.get_smart_client()
 
2397
            medium = transport.get_smart_medium()
2397
2398
        except (NotImplementedError, AttributeError,
2398
 
                errors.TransportNotPossible):
 
2399
                errors.TransportNotPossible, errors.NoSmartMedium):
2399
2400
            # no smart server, so not a branch for this format type.
2400
2401
            raise errors.NotBranchError(path=transport.base)
2401
2402
        else:
2402
 
            # Send a 'hello' request in protocol version one, and decline to
2403
 
            # open it if the server doesn't support our required version (2) so
2404
 
            # that the VFS-based transport will do it.
2405
 
            request = client.get_request()
2406
 
            smart_protocol = protocol.SmartClientRequestProtocolOne(request)
2407
 
            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)
2408
2411
            if server_version != 2:
2409
2412
                raise errors.NotBranchError(path=transport.base)
2410
2413
            return klass()
2412
2415
    def initialize_on_transport(self, transport):
2413
2416
        try:
2414
2417
            # hand off the request to the smart server
2415
 
            shared_medium = transport.get_shared_medium()
 
2418
            client_medium = transport.get_smart_medium()
2416
2419
        except errors.NoSmartMedium:
2417
2420
            # TODO: lookup the local format from a server hint.
2418
2421
            local_dir_format = BzrDirMetaFormat1()
2419
2422
            return local_dir_format.initialize_on_transport(transport)
2420
 
        client = _SmartClient(shared_medium)
 
2423
        client = _SmartClient(client_medium, transport.base)
2421
2424
        path = client.remote_path_from_transport(transport)
2422
 
        response = _SmartClient(shared_medium).call('BzrDirFormat.initialize',
2423
 
                                                    path)
 
2425
        response = client.call('BzrDirFormat.initialize', path)
2424
2426
        assert response[0] in ('ok', ), 'unexpected response code %s' % (response,)
2425
2427
        return remote.RemoteBzrDir(transport)
2426
2428