~bzr/ubuntu/hardy/bzr/bzr-ppa

« back to all changes in this revision

Viewing changes to bzrlib/bundle/__init__.py

  • Committer: Max Bowsher
  • Date: 2011-02-09 04:09:41 UTC
  • mfrom: (0.5074.21 hardy)
  • Revision ID: maxb@f2s.com-20110209040941-4c6g890kt3pj7vjo
Merge beta-ppa into ppa upon release of 2.3.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from cStringIO import StringIO
18
18
 
19
 
from bzrlib.symbol_versioning import deprecated_function, deprecated_in
20
19
from bzrlib.lazy_import import lazy_import
21
20
lazy_import(globals(), """
22
21
from bzrlib import (
23
22
    errors,
 
23
    transport as _mod_transport,
24
24
    urlutils,
25
25
    )
26
26
from bzrlib.bundle import serializer as _serializer
27
27
from bzrlib.merge_directive import MergeDirective
28
 
from bzrlib.transport import (
29
 
    do_catching_redirections,
30
 
    get_transport,
31
 
    )
32
28
""")
33
29
from bzrlib.trace import note
34
30
 
35
31
 
36
 
@deprecated_function(deprecated_in((1, 12, 0)))
37
 
def read_bundle_from_url(url):
38
 
    return read_mergeable_from_url(url, _do_directive=False)
39
 
 
40
 
 
41
32
def read_mergeable_from_url(url, _do_directive=True, possible_transports=None):
42
33
    """Read mergable object from a given URL.
43
34
 
44
35
    :return: An object supporting get_target_revision.  Raises NotABundle if
45
36
        the target is not a mergeable type.
46
37
    """
47
 
    child_transport = get_transport(url,
 
38
    child_transport = _mod_transport.get_transport(url,
48
39
        possible_transports=possible_transports)
49
40
    transport = child_transport.clone('..')
50
41
    filename = transport.relpath(child_transport.base)
63
54
                                       exclude_trailing_slash=False)
64
55
        if not filename:
65
56
            raise errors.NotABundle('A directory cannot be a bundle')
66
 
        return get_transport(url)
 
57
        return _mod_transport.get_transport(url)
67
58
 
68
59
    try:
69
 
        bytef, transport = do_catching_redirections(get_bundle, transport,
70
 
                                                    redirected_transport)
 
60
        bytef, transport = _mod_transport.do_catching_redirections(
 
61
            get_bundle, transport, redirected_transport)
71
62
    except errors.TooManyRedirections:
72
63
        raise errors.NotABundle(transport.clone(filename).base)
73
64
    except (errors.ConnectionReset, errors.ConnectionError), e: