changeset 24036:c7601086338a

bundle2.unbundlepart: tell() implementation Keep track of how many bytes we've returned from read(); fairly straightforward.
author Eric Sumner <ericsumner@fb.com>
date Wed, 14 Jan 2015 15:57:57 -0800
parents 7eb26415bef6
children f0b498cfc5c8
files mercurial/bundle2.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Wed Jan 14 14:46:23 2015 -0800
+++ b/mercurial/bundle2.py	Wed Jan 14 15:57:57 2015 -0800
@@ -828,6 +828,7 @@
         self._readheader()
         self._mandatory = None
         self._chunkindex = [] #(payload, file) position tuples for chunk starts
+        self._pos = 0
 
     def _fromheader(self, size):
         """return the next <size> byte from the header"""
@@ -930,8 +931,12 @@
             data = self._payloadstream.read(size)
         if size is None or len(data) < size:
             self.consumed = True
+        self._pos += len(data)
         return data
 
+    def tell(self):
+        return self._pos
+
 capabilities = {'HG2Y': (),
                 'b2x:listkeys': (),
                 'b2x:pushkey': (),