~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-16 01:47:06 UTC
  • mfrom: (1910.19.16 smart-server)
  • Revision ID: pqm@pqm.ubuntu.com-20060916014706-93f2994bdb0c0850
(spiv,mpool,robertc) Create a RPC protocol as the building blocks for a smart server

Show diffs side-by-side

added added

removed removed

Lines of Context:
341
341
        # transports?
342
342
        if not isinstance(relpath, str):
343
343
            raise errors.InvalidURL("not a valid url: %r" % relpath)
344
 
        base_parts = base_path.split('/')
 
344
        if relpath.startswith('/'):
 
345
            base_parts = []
 
346
        else:
 
347
            base_parts = base_path.split('/')
345
348
        if len(base_parts) > 0 and base_parts[-1] == '':
346
349
            base_parts = base_parts[:-1]
347
350
        for p in relpath.split('/'):
427
430
        """Get the file at the given relative path.
428
431
 
429
432
        :param relpath: The relative path to the file
 
433
        :rtype: File-like object.
430
434
        """
431
435
        raise NotImplementedError(self.get)
432
436
 
437
441
        """
438
442
        return self.get(relpath).read()
439
443
 
 
444
    def get_smart_client(self):
 
445
        """Return a smart client for this transport if possible.
 
446
 
 
447
        :raises NoSmartServer: if no smart server client is available.
 
448
        """
 
449
        raise errors.NoSmartServer(self.base)
 
450
 
440
451
    def readv(self, relpath, offsets):
441
452
        """Get parts of the file at the given relative path.
442
453
 
1152
1163
register_lazy_transport('memory://', 'bzrlib.transport.memory', 'MemoryTransport')
1153
1164
register_lazy_transport('readonly+', 'bzrlib.transport.readonly', 'ReadonlyTransportDecorator')
1154
1165
register_lazy_transport('fakenfs+', 'bzrlib.transport.fakenfs', 'FakeNFSTransportDecorator')
1155
 
register_lazy_transport('vfat+', 
 
1166
register_lazy_transport('vfat+',
1156
1167
                        'bzrlib.transport.fakevfat',
1157
1168
                        'FakeVFATTransportDecorator')
 
1169
register_lazy_transport('bzr://',
 
1170
                        'bzrlib.transport.smart',
 
1171
                        'SmartTCPTransport')
 
1172
register_lazy_transport('bzr+ssh://',
 
1173
                        'bzrlib.transport.smart',
 
1174
                        'SmartSSHTransport')