D7956: lfs: drop the unused progressbar code in the `filewithprogress` class
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Tue Jan 21 18:37:42 UTC 2020
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This has been unused since f98fac24b757 <https://phab.mercurial-scm.org/rHGf98fac24b757fad592974732d93de71f4c80bfe4>, 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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D7956
AFFECTED FILES
hgext/lfs/blobstore.py
CHANGE DETAILS
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))
To: mharbison72, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list