~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-10-11 09:26:57 UTC
  • mfrom: (1996.3.37 use_lazy_importer)
  • Revision ID: pqm@pqm.ubuntu.com-20061011092657-e42bec6ef14c036c
(John Arbash Meinel) use lazy importing to improve startup time

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.
1031
1033
    for factory in factory_list:
1032
1034
        try:
1033
1035
            return factory(base), None
1034
 
        except DependencyNotPresent, e:
 
1036
        except errors.DependencyNotPresent, e:
1035
1037
            mutter("failed to instantiate transport %r for %r: %r" %
1036
1038
                    (factory, base, e))
1037
1039
            last_err = e
1084
1086
    """
1085
1087
 
1086
1088
    def adapt(self, test):
1087
 
        result = TestSuite()
 
1089
        result = unittest.TestSuite()
1088
1090
        for klass, server_factory in self._test_permutations():
1089
1091
            new_test = deepcopy(test)
1090
1092
            new_test.transport_class = klass