~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/medium.py

  • Committer: Martin Pool
  • Date: 2007-10-10 00:21:57 UTC
  • mfrom: (2900 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2901.
  • Revision ID: mbp@sourcefrog.net-20071010002157-utci0x44m2w47wgd
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import socket
29
29
import sys
30
30
 
31
 
from bzrlib import errors
 
31
from bzrlib import (
 
32
    errors,
 
33
    symbol_versioning,
 
34
    )
32
35
from bzrlib.smart.protocol import (
33
36
    REQUEST_VERSION_TWO,
34
37
    SmartServerRequestProtocolOne,
443
446
    """A client medium using SSH."""
444
447
    
445
448
    def __init__(self, host, port=None, username=None, password=None,
446
 
            vendor=None):
 
449
            vendor=None, bzr_remote_path=None):
447
450
        """Creates a client that will connect on the first use.
448
451
        
449
452
        :param vendor: An optional override for the ssh vendor to use. See
459
462
        self._ssh_connection = None
460
463
        self._vendor = vendor
461
464
        self._write_to = None
 
465
        self._bzr_remote_path = bzr_remote_path
 
466
        if self._bzr_remote_path is None:
 
467
            symbol_versioning.warn(
 
468
                'bzr_remote_path is required as of bzr 0.92',
 
469
                DeprecationWarning, stacklevel=2)
 
470
            self._bzr_remote_path = os.environ.get('BZR_REMOTE_PATH', 'bzr')
462
471
 
463
472
    def _accept_bytes(self, bytes):
464
473
        """See SmartClientStreamMedium.accept_bytes."""
478
487
        """Connect this medium if not already connected."""
479
488
        if self._connected:
480
489
            return
481
 
        executable = os.environ.get('BZR_REMOTE_PATH', 'bzr')
482
490
        if self._vendor is None:
483
491
            vendor = ssh._get_ssh_vendor()
484
492
        else:
485
493
            vendor = self._vendor
486
494
        self._ssh_connection = vendor.connect_ssh(self._username,
487
495
                self._password, self._host, self._port,
488
 
                command=[executable, 'serve', '--inet', '--directory=/',
489
 
                         '--allow-writes'])
 
496
                command=[self._bzr_remote_path, 'serve', '--inet',
 
497
                         '--directory=/', '--allow-writes'])
490
498
        self._read_from, self._write_to = \
491
499
            self._ssh_connection.get_filelike_channels()
492
500
        self._connected = True