~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/__init__.py

  • Committer: Patch Queue Manager
  • Date: 2015-04-21 05:32:33 UTC
  • mfrom: (6602.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20150421053233-x63rhby1q3612v2h
(richard-wilbur) (jelmer)Make bzr build reproducible for Debian. (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
 
18
 
17
19
from cStringIO import StringIO
18
20
 
19
 
from bzrlib.symbol_versioning import deprecated_function, deprecated_in
20
21
from bzrlib.lazy_import import lazy_import
21
22
lazy_import(globals(), """
22
23
from bzrlib import (
23
24
    errors,
 
25
    transport as _mod_transport,
24
26
    urlutils,
25
27
    )
26
28
from bzrlib.bundle import serializer as _serializer
27
29
from bzrlib.merge_directive import MergeDirective
28
 
from bzrlib.transport import (
29
 
    do_catching_redirections,
30
 
    get_transport,
31
 
    )
 
30
from bzrlib.i18n import gettext
32
31
""")
33
32
from bzrlib.trace import note
34
33
 
35
34
 
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
35
def read_mergeable_from_url(url, _do_directive=True, possible_transports=None):
42
36
    """Read mergable object from a given URL.
43
37
 
44
38
    :return: An object supporting get_target_revision.  Raises NotABundle if
45
39
        the target is not a mergeable type.
46
40
    """
47
 
    child_transport = get_transport(url,
 
41
    child_transport = _mod_transport.get_transport(url,
48
42
        possible_transports=possible_transports)
49
43
    transport = child_transport.clone('..')
50
44
    filename = transport.relpath(child_transport.base)
62
56
        url, filename = urlutils.split(exception.target,
63
57
                                       exclude_trailing_slash=False)
64
58
        if not filename:
65
 
            raise errors.NotABundle('A directory cannot be a bundle')
66
 
        return get_transport(url)
 
59
            raise errors.NotABundle(gettext('A directory cannot be a bundle'))
 
60
        return _mod_transport.get_transport_from_url(url)
67
61
 
68
62
    try:
69
 
        bytef, transport = do_catching_redirections(get_bundle, transport,
70
 
                                                    redirected_transport)
 
63
        bytef, transport = _mod_transport.do_catching_redirections(
 
64
            get_bundle, transport, redirected_transport)
71
65
    except errors.TooManyRedirections:
72
66
        raise errors.NotABundle(transport.clone(filename).base)
73
67
    except (errors.ConnectionReset, errors.ConnectionError), e: