Rev 3075: Cleanup (thanks *again* to --coverage). in file:///v/home/vila/src/bzr/bugs/173010/

Vincent Ladeuil v.ladeuil+lp at free.fr
Sat Dec 8 16:26:40 GMT 2007


At file:///v/home/vila/src/bzr/bugs/173010/

------------------------------------------------------------
revno: 3075
revision-id:v.ladeuil+lp at free.fr-20071208162634-j0g3q0xjr1g7abam
parent: v.ladeuil+lp at free.fr-20071208145052-nq3evn50kvqkvp1t
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 173010
timestamp: Sat 2007-12-08 17:26:34 +0100
message:
  Cleanup (thanks *again* to --coverage).
  
  * bzrlib/transport/http/__init__.py:
  (HttpTransportBase._get_ranges_hinted): Deleted, not used anymore
  by _readv.
  (HttpTransportBase.offsets_to_ranges): Deprecated in 0.17.
modified:
  bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
-------------- next part --------------
=== modified file 'bzrlib/transport/http/__init__.py'
--- a/bzrlib/transport/http/__init__.py	2007-12-06 22:46:16 +0000
+++ b/bzrlib/transport/http/__init__.py	2007-12-08 16:26:34 +0000
@@ -139,6 +139,7 @@
         # time of this writing it's even the only known client -- vila20071203
         return StringIO(response_file.read())
 
+    # TODO: Add tests for tail_amount or deprecate it
     def _get(self, relpath, ranges, tail_amount=0):
         """Get a file, or part of a file.
 
@@ -175,30 +176,6 @@
             # further tries were unsuccessful
             raise exc_info[0], exc_info[1], exc_info[2]
 
-    def _get_ranges_hinted(self, relpath, ranges):
-        """Issue a ranged GET request taking server capabilities into account.
-
-        Depending of the errors returned by the server, we try several GET
-        requests, trying to minimize the data transferred.
-
-        :param relpath: Path relative to transport base URL
-        :param ranges: None to get the whole file;
-            or  a list of _CoalescedOffset to fetch parts of a file.
-        :returns: A file handle containing at least the requested ranges.
-        """
-        exc_info = None
-        try_again = True
-        while try_again:
-            try_again = False
-            try:
-                code, f = self._get(relpath, ranges)
-            except errors.InvalidHttpRange, e:
-                if exc_info is None:
-                    exc_info = sys.exc_info()
-                self._degrade_range_hint(relpath, ranges, exc_info)
-                try_again = True
-        return f
-
     # _coalesce_offsets is a helper for readv, it try to combine ranges without
     # degrading readv performances. _bytes_to_read_before_seek is the value
     # used for the limit parameter and has been tuned for other transports. For
@@ -319,34 +296,6 @@
         """
         return 64 * 1024
 
-    @staticmethod
-    @deprecated_method(zero_seventeen)
-    def offsets_to_ranges(offsets):
-        """Turn a list of offsets and sizes into a list of byte ranges.
-
-        :param offsets: A list of tuples of (start, size).  An empty list
-            is not accepted.
-        :return: a list of inclusive byte ranges (start, end) 
-            Adjacent ranges will be combined.
-        """
-        # Make sure we process sorted offsets
-        offsets = sorted(offsets)
-
-        prev_end = None
-        combined = []
-
-        for start, size in offsets:
-            end = start + size - 1
-            if prev_end is None:
-                combined.append([start, end])
-            elif start <= prev_end + 1:
-                combined[-1][1] = end
-            else:
-                combined.append([start, end])
-            prev_end = end
-
-        return combined
-
     def _post(self, body_bytes):
         """POST body_bytes to .bzr/smart on this transport.
         



More information about the bazaar-commits mailing list