/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/bundle/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from __future__ import absolute_import
18
18
 
19
 
from cStringIO import StringIO
20
19
 
21
 
from bzrlib.lazy_import import lazy_import
 
20
from ..lazy_import import lazy_import
22
21
lazy_import(globals(), """
23
 
from bzrlib import (
 
22
from breezy import (
24
23
    errors,
25
24
    transport as _mod_transport,
26
25
    urlutils,
27
26
    )
28
 
from bzrlib.bundle import serializer as _serializer
29
 
from bzrlib.merge_directive import MergeDirective
30
 
from bzrlib.i18n import gettext
 
27
from breezy.bundle import serializer as _serializer
 
28
from breezy.merge_directive import MergeDirective
 
29
from breezy.i18n import gettext
31
30
""")
32
 
from bzrlib.trace import note
 
31
from ..sixish import (
 
32
    BytesIO,
 
33
    )
 
34
from ..trace import note
33
35
 
34
36
 
35
37
def read_mergeable_from_url(url, _do_directive=True, possible_transports=None):
49
51
 
50
52
def read_mergeable_from_transport(transport, filename, _do_directive=True):
51
53
    def get_bundle(transport):
52
 
        return StringIO(transport.get_bytes(filename)), transport
 
54
        return BytesIO(transport.get_bytes(filename)), transport
53
55
 
54
56
    def redirected_transport(transport, exception, redirection_notice):
55
57
        note(redirection_notice)
64
66
            get_bundle, transport, redirected_transport)
65
67
    except errors.TooManyRedirections:
66
68
        raise errors.NotABundle(transport.clone(filename).base)
67
 
    except (errors.ConnectionReset, errors.ConnectionError), e:
 
69
    except (errors.ConnectionReset, errors.ConnectionError) as e:
68
70
        raise
69
 
    except (errors.TransportError, errors.PathError), e:
 
71
    except (errors.TransportError, errors.PathError) as e:
70
72
        raise errors.NotABundle(str(e))
71
 
    except (IOError,), e:
 
73
    except (IOError,) as e:
72
74
        # jam 20060707
73
75
        # Abstraction leakage, SFTPTransport.get('directory')
74
76
        # doesn't always fail at get() time. Sometimes it fails