/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/transport/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-13 07:22:23 UTC
  • mfrom: (2076 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2077.
  • Revision ID: john@arbash-meinel.com-20061013072223-9d1320456e7df776
[merge] bzr.dev 2076

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
it.
27
27
"""
28
28
 
 
29
from cStringIO import StringIO
 
30
import re
 
31
import sys
 
32
 
 
33
from bzrlib.lazy_import import lazy_import
 
34
lazy_import(globals(), """
29
35
import errno
30
36
from collections import deque
31
37
from copy import deepcopy
32
 
from cStringIO import StringIO
33
 
import re
34
38
from stat import S_ISDIR
35
 
import sys
36
 
from unittest import TestSuite
 
39
import unittest
37
40
import urllib
38
41
import urlparse
39
42
import warnings
45
48
    symbol_versioning,
46
49
    urlutils,
47
50
    )
48
 
from bzrlib.errors import DependencyNotPresent
49
 
from bzrlib.osutils import pumpfile
 
51
""")
 
52
 
50
53
from bzrlib.symbol_versioning import (
51
54
        deprecated_passed,
52
55
        deprecated_method,
262
265
        """
263
266
        assert not isinstance(from_file, basestring), \
264
267
            '_pump should only be called on files not %s' % (type(from_file,))
265
 
        pumpfile(from_file, to_file)
 
268
        osutils.pumpfile(from_file, to_file)
266
269
 
267
270
    def _get_total(self, multi):
268
271
        """Try to figure out how many entries are in multi,
323
326
 
324
327
        Examples::
325
328
 
326
 
            >>> t = Transport('/')
327
 
            >>> t._combine_paths('/home/sarah', 'project/foo')
328
 
            '/home/sarah/project/foo'
329
 
            >>> t._combine_paths('/home/sarah', '../../etc')
330
 
            '/etc'
 
329
            t._combine_paths('/home/sarah', 'project/foo')
 
330
                => '/home/sarah/project/foo'
 
331
            t._combine_paths('/home/sarah', '../../etc')
 
332
                => '/etc'
331
333
 
332
334
        :param base_path: urlencoded path for the transport root; typically a 
333
335
             URL but need not contain scheme/host/etc.
444
446
    def get_smart_client(self):
445
447
        """Return a smart client for this transport if possible.
446
448
 
 
449
        A smart client doesn't imply the presence of a smart server: it implies
 
450
        that the smart protocol can be tunnelled via this transport.
 
451
 
447
452
        :raises NoSmartServer: if no smart server client is available.
448
453
        """
449
454
        raise errors.NoSmartServer(self.base)
450
455
 
 
456
    def get_smart_medium(self):
 
457
        """Return a smart client medium for this transport if possible.
 
458
 
 
459
        A smart medium doesn't imply the presence of a smart server: it implies
 
460
        that the smart protocol can be tunnelled via this transport.
 
461
 
 
462
        :raises NoSmartMedium: if no smart server medium is available.
 
463
        """
 
464
        raise errors.NoSmartMedium(self)
 
465
 
451
466
    def readv(self, relpath, offsets):
452
467
        """Get parts of the file at the given relative path.
453
468
 
1031
1046
    for factory in factory_list:
1032
1047
        try:
1033
1048
            return factory(base), None
1034
 
        except DependencyNotPresent, e:
 
1049
        except errors.DependencyNotPresent, e:
1035
1050
            mutter("failed to instantiate transport %r for %r: %r" %
1036
1051
                    (factory, base, e))
1037
1052
            last_err = e
1084
1099
    """
1085
1100
 
1086
1101
    def adapt(self, test):
1087
 
        result = TestSuite()
 
1102
        result = unittest.TestSuite()
1088
1103
        for klass, server_factory in self._test_permutations():
1089
1104
            new_test = deepcopy(test)
1090
1105
            new_test.transport_class = klass