# HG changeset patch # User Matt Harbison # Date 1579617640 18000 # Node ID 5f841daf3b41a041bfdbc56d8172d046ab87a269 # Parent 3bd77c64bc740e5f328eefc4e21bc5b468bdd496 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 diff -r 3bd77c64bc74 -r 5f841daf3b41 hgext/lfs/blobstore.py --- 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))