~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-23 16:48:41 UTC
  • mto: (6437.41.3 rmbranch-active)
  • mto: This revision was merged to the branch mainline in revision 6481.
  • Revision ID: jelmer@samba.org-20120223164841-eyy9xljbpblkchba
Support colocated branches in 'bzr rmbranch'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from __future__ import absolute_import
23
23
 
24
 
import os
 
24
from cStringIO import StringIO
25
25
import re
26
26
import urlparse
27
27
import sys
119
119
        :param relpath: The relative path to the file
120
120
        """
121
121
        code, response_file = self._get(relpath, None)
122
 
        return response_file
 
122
        # FIXME: some callers want an iterable... One step forward, three steps
 
123
        # backwards :-/ And not only an iterable, but an iterable that can be
 
124
        # seeked backwards, so we will never be able to do that.  One such
 
125
        # known client is bzrlib.bundle.serializer.v4.get_bundle_reader. At the
 
126
        # time of this writing it's even the only known client -- vila20071203
 
127
        return StringIO(response_file.read())
123
128
 
124
129
    def _get(self, relpath, ranges, tail_amount=0):
125
130
        """Get a file, or part of a file.
237
242
                    # Split the received chunk
238
243
                    for offset, size in cur_coal.ranges:
239
244
                        start = cur_coal.start + offset
240
 
                        rfile.seek(start, os.SEEK_SET)
 
245
                        rfile.seek(start, 0)
241
246
                        data = rfile.read(size)
242
247
                        data_len = len(data)
243
248
                        if data_len != size: