changeset 44138:5f841daf3b41

lfs: drop the unused progressbar code in the `filewithprogress` class This has been unused since f98fac24b757, which added worker based transfers for concurrency, shifting the progressbar maintenance to the single thread waiting on the worker to complete. Since the name no longer fits, rename the class. Differential Revision: https://phab.mercurial-scm.org/D7956
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 21 Jan 2020 09:40:40 -0500
parents 3bd77c64bc74
children 2ad4e8aefcf4
files hgext/lfs/blobstore.py
diffstat 1 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/lfs/blobstore.py	Tue Jan 14 16:58:07 2020 +0100
+++ b/hgext/lfs/blobstore.py	Tue Jan 21 09:40:40 2020 -0500
@@ -94,15 +94,12 @@
         pass
 
 
-class filewithprogress(object):
+class lfsuploadfile(object):
     """a file-like object that supports __len__ and read.
-
-    Useful to provide progress information for how many bytes are read.
     """
 
-    def __init__(self, fp, callback):
+    def __init__(self, fp):
         self._fp = fp
-        self._callback = callback  # func(readsize)
         fp.seek(0, os.SEEK_END)
         self._len = fp.tell()
         fp.seek(0)
@@ -114,10 +111,7 @@
         if self._fp is None:
             return b''
         data = self._fp.read(size)
-        if data:
-            if self._callback:
-                self._callback(len(data))
-        else:
+        if not data:
             self._fp.close()
             self._fp = None
         return data
@@ -495,7 +489,7 @@
                     _(b'detected corrupt lfs object: %s') % oid,
                     hint=_(b'run hg verify'),
                 )
-            request.data = filewithprogress(localstore.open(oid), None)
+            request.data = lfsuploadfile(localstore.open(oid))
             request.get_method = lambda: r'PUT'
             request.add_header('Content-Type', 'application/octet-stream')
             request.add_header('Content-Length', len(request.data))