Patchwork D7956: lfs: drop the unused progressbar code in the `filewithprogress` class

login
register
mail settings
Submitter phabricator
Date Jan. 22, 2020, 3:59 p.m.
Message ID <d5048e4db4043ad779b33f35f9fb130e@localhost.localdomain>
Download mbox | patch
Permalink /patch/44569/
State Not Applicable
Headers show

Comments

phabricator - Jan. 22, 2020, 3:59 p.m.
Closed by commit rHG0e7add24399a: lfs: drop the unused progressbar code in the `filewithprogress` class (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7956?vs=19490&id=19506

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7956/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7956

AFFECTED FILES
  hgext/lfs/blobstore.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
--- a/hgext/lfs/blobstore.py
+++ b/hgext/lfs/blobstore.py
@@ -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))