~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: 2009-02-23 17:00:36 UTC
  • mfrom: (4032.1.4 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090223170036-3q1v68ewdt8i0to5
(Marius Kruger) Remove all trailing whitespace and add tests to
        enforce this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
 
53
53
    The connection has a notion of the current directory to which it's
54
54
    connected; this is incorporated in filenames passed to the server.
55
 
    
56
 
    This supports some higher-level RPC operations and can also be treated 
 
55
 
 
56
    This supports some higher-level RPC operations and can also be treated
57
57
    like a Transport to do file-like operations.
58
58
 
59
59
    The connection can be made over a tcp socket, an ssh pipe or a series of
67
67
    # IMPORTANT FOR IMPLEMENTORS: RemoteTransport MUST NOT be given encoding
68
68
    # responsibilities: Put those on SmartClient or similar. This is vital for
69
69
    # the ability to support multiple versions of the smart protocol over time:
70
 
    # RemoteTransport is an adapter from the Transport object model to the 
 
70
    # RemoteTransport is an adapter from the Transport object model to the
71
71
    # SmartClient model, not an encoder.
72
72
 
73
73
    # FIXME: the medium parameter should be private, only the tests requires
206
206
 
207
207
    def get(self, relpath):
208
208
        """Return file-like object reading the contents of a remote file.
209
 
        
 
209
 
210
210
        :see: Transport.get_bytes()/get_file()
211
211
        """
212
212
        return StringIO(self.get_bytes(relpath))
291
291
 
292
292
    def append_file(self, relpath, from_file, mode=None):
293
293
        return self.append_bytes(relpath, from_file.read(), mode)
294
 
        
 
294
 
295
295
    def append_bytes(self, relpath, bytes, mode=None):
296
296
        resp = self._call_with_body_bytes(
297
297
            'append',
313
313
    def recommended_page_size(self):
314
314
        """Return the recommended page size for this transport."""
315
315
        return 64 * 1024
316
 
        
 
316
 
317
317
    def _readv(self, relpath, offsets):
318
318
        if not offsets:
319
319
            return
421
421
    def _ensure_ok(self, resp):
422
422
        if resp[0] != 'ok':
423
423
            raise errors.UnexpectedSmartServerResponse(resp)
424
 
        
 
424
 
425
425
    def _translate_error(self, err, relpath=None):
426
426
        remote._translate_error(err, path=relpath)
427
427
 
465
465
 
466
466
class RemoteTCPTransport(RemoteTransport):
467
467
    """Connection to smart server over plain tcp.
468
 
    
 
468
 
469
469
    This is essentially just a factory to get 'RemoteTransport(url,
470
470
        SmartTCPClientMedium).
471
471
    """
513
513
 
514
514
class RemoteHTTPTransport(RemoteTransport):
515
515
    """Just a way to connect between a bzr+http:// url and http://.
516
 
    
 
516
 
517
517
    This connection operates slightly differently than the RemoteSSHTransport.
518
518
    It uses a plain http:// transport underneath, which defines what remote
519
519
    .bzr/smart URL we are connected to. From there, all paths that are sent are
584
584
    """Simple transport that handles ssh:// and points out bzr+ssh://."""
585
585
 
586
586
    def __init__(self, url):
587
 
        raise errors.UnsupportedProtocol(url, 
 
587
        raise errors.UnsupportedProtocol(url,
588
588
            'bzr supports bzr+ssh to operate over ssh, use "bzr+%s".' % url)
589
589
 
590
590