~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-12 22:12:30 UTC
  • mto: This revision was merged to the branch mainline in revision 2071.
  • Revision ID: john@arbash-meinel.com-20060912221230-d3980a26890a32e3
lazy_import bundle and bundle.commands

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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
from bzrlib.lazy_import import lazy_import
 
18
lazy_import(globals(), """
 
19
from bzrlib import (
 
20
    errors,
 
21
    urlutils,
 
22
    )
17
23
from bzrlib.bundle.serializer import read_bundle
18
 
import bzrlib.errors as errors
19
 
import bzrlib.urlutils
20
 
import bzrlib.transport
 
24
from bzrlib.transport import 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, filename = urlutils.split(url, exclude_trailing_slash=False)
30
35
    if not filename:
31
36
        # A path to a directory was passed in
32
37
        # definitely not a bundle
36
41
    # Some transports cannot detect that we are trying to read a
37
42
    # directory until we actually issue read() on the handle.
38
43
    try:
39
 
        t = bzrlib.transport.get_transport(url)
 
44
        t = get_transport(url)
40
45
        f = t.get(filename)
41
46
        return read_bundle(f)
42
47
    except (errors.TransportError, errors.PathError), e: