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

[merge] bzr.dev 2255, resolve conflicts, update copyrights

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 by Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
from bzrlib.bundle.serializer import read_bundle
18
 
import bzrlib.errors as errors
19
 
import bzrlib.urlutils
20
 
import bzrlib.transport
 
17
from bzrlib.lazy_import import lazy_import
 
18
lazy_import(globals(), """
 
19
from bzrlib import (
 
20
    errors,
 
21
    urlutils,
 
22
    )
 
23
from bzrlib.bundle import serializer as _serializer
 
24
from bzrlib.transport import get_transport as _get_transport
 
25
""")
21
26
 
22
27
 
23
28
def read_bundle_from_url(url):
26
31
    :return: A BundleReader, may raise NotABundle if the target 
27
32
            is not a proper bundle.
28
33
    """
29
 
    url, filename = bzrlib.urlutils.split(url, exclude_trailing_slash=False)
 
34
    url = urlutils.normalize_url(url)
 
35
    url, filename = urlutils.split(url, exclude_trailing_slash=False)
30
36
    if not filename:
31
37
        # A path to a directory was passed in
32
38
        # definitely not a bundle
36
42
    # Some transports cannot detect that we are trying to read a
37
43
    # directory until we actually issue read() on the handle.
38
44
    try:
39
 
        t = bzrlib.transport.get_transport(url)
 
45
        t = _get_transport(url)
40
46
        f = t.get(filename)
41
 
        return read_bundle(f)
 
47
        return _serializer.read_bundle(f)
42
48
    except (errors.TransportError, errors.PathError), e:
43
49
        raise errors.NotABundle(str(e))
44
50
    except (IOError,), e: