~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/__init__.py

  • Committer: Martin
  • Date: 2009-11-28 00:48:03 UTC
  • mto: This revision was merged to the branch mainline in revision 4853.
  • Revision ID: gzlist@googlemail.com-20091128004803-nirz54wazyj0waf8
MergeDirective.from_lines claims to want an iterable but currently requires a list, rewrite so it really wants an iterable

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 
56
56
def read_mergeable_from_transport(transport, filename, _do_directive=True):
57
57
    def get_bundle(transport):
58
 
        return transport.get_bytes(filename), transport
 
58
        return StringIO(transport.get_bytes(filename)), transport
59
59
 
60
60
    def redirected_transport(transport, exception, redirection_notice):
61
61
        note(redirection_notice)
66
66
        return get_transport(url)
67
67
 
68
68
    try:
69
 
        bytes, transport = do_catching_redirections(get_bundle, transport,
 
69
        bytef, transport = do_catching_redirections(get_bundle, transport,
70
70
                                                    redirected_transport)
71
71
    except errors.TooManyRedirections:
72
72
        raise errors.NotABundle(transport.clone(filename).base)
86
86
 
87
87
    if _do_directive:
88
88
        try:
89
 
            return MergeDirective.from_lines(bytes.splitlines(True)), transport
 
89
            return MergeDirective.from_lines(bytef), transport
90
90
        except errors.NotAMergeDirective:
91
 
            pass
 
91
            bytef.seek(0)
92
92
 
93
 
    return _serializer.read_bundle(StringIO(bytes)), transport
 
93
    return _serializer.read_bundle(bytef), transport