~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/remote.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-05-20 07:16:50 UTC
  • mfrom: (3431.3.11 bug-230550)
  • Revision ID: pqm@pqm.ubuntu.com-20080520071650-9vbizb6v6ji8k1jy
Fix spurious "No repository present" errors when accessing branches
        in shared repos via bzr+http.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
            one is being cloned from.  Attributes such as the medium will
78
78
            be reused.
79
79
 
80
 
        :param medium: The medium to use for this RemoteTransport. This must be
81
 
            supplied if _from_transport is None.
 
80
        :param medium: The medium to use for this RemoteTransport.  If None,
 
81
            the medium from the _from_transport is shared.  If both this
 
82
            and _from_transport are None, a new medium will be built.
 
83
            _from_transport and medium cannot both be specified.
82
84
 
83
85
        :param _client: Override the _SmartClient used by this transport.  This
84
86
            should only be used for testing purposes; normally this is
103
105
            self._shared_connection = transport._SharedConnection(medium,
104
106
                                                                  credentials,
105
107
                                                                  self.base)
 
108
        elif medium is None:
 
109
            # No medium was specified, so share the medium from the
 
110
            # _from_transport.
 
111
            medium = self._shared_connection.connection
106
112
        else:
107
 
            if medium is None:
108
 
                # No medium was specified, so share the medium from the
109
 
                # _from_transport.
110
 
                medium = self._shared_connection.connection
 
113
            raise AssertionError(
 
114
                "Both _from_transport (%r) and medium (%r) passed to "
 
115
                "RemoteTransport.__init__, but these parameters are mutally "
 
116
                "exclusive." % (_from_transport, medium))
111
117
 
112
118
        if _client is None:
113
 
            self._client = client._SmartClient(medium, self.base)
 
119
            self._client = client._SmartClient(medium)
114
120
        else:
115
121
            self._client = _client
116
122
 
464
470
    """
465
471
 
466
472
    def _build_medium(self):
467
 
        return medium.SmartTCPClientMedium(self._host, self._port), None
 
473
        client_medium = medium.SmartTCPClientMedium(
 
474
            self._host, self._port, self.base)
 
475
        return client_medium, None
468
476
 
469
477
 
470
478
class RemoteSSHTransport(RemoteTransport):
480
488
        # stored.
481
489
        location_config = config.LocationConfig(self.base)
482
490
        bzr_remote_path = location_config.get_bzr_remote_path()
483
 
        return medium.SmartSSHClientMedium(self._host, self._port,
484
 
            self._user, self._password, bzr_remote_path=bzr_remote_path), None
 
491
        client_medium = medium.SmartSSHClientMedium(self._host, self._port,
 
492
            self._user, self._password, self.base,
 
493
            bzr_remote_path=bzr_remote_path)
 
494
        return client_medium, None
485
495
 
486
496
 
487
497
class RemoteHTTPTransport(RemoteTransport):