##// END OF EJS Templates
lfs: drop the unused progressbar code in the `filewithprogress` class...
Matt Harbison -
r44596:5f841daf default
parent child Browse files
Show More
@@ -94,15 +94,12 b' class nullvfs(lfsvfs):'
94 94 pass
95 95
96 96
97 class filewithprogress(object):
97 class lfsuploadfile(object):
98 98 """a file-like object that supports __len__ and read.
99
100 Useful to provide progress information for how many bytes are read.
101 99 """
102 100
103 def __init__(self, fp, callback):
101 def __init__(self, fp):
104 102 self._fp = fp
105 self._callback = callback # func(readsize)
106 103 fp.seek(0, os.SEEK_END)
107 104 self._len = fp.tell()
108 105 fp.seek(0)
@@ -114,10 +111,7 b' class filewithprogress(object):'
114 111 if self._fp is None:
115 112 return b''
116 113 data = self._fp.read(size)
117 if data:
118 if self._callback:
119 self._callback(len(data))
120 else:
114 if not data:
121 115 self._fp.close()
122 116 self._fp = None
123 117 return data
@@ -495,7 +489,7 b' class _gitlfsremote(object):'
495 489 _(b'detected corrupt lfs object: %s') % oid,
496 490 hint=_(b'run hg verify'),
497 491 )
498 request.data = filewithprogress(localstore.open(oid), None)
492 request.data = lfsuploadfile(localstore.open(oid))
499 493 request.get_method = lambda: r'PUT'
500 494 request.add_header('Content-Type', 'application/octet-stream')
501 495 request.add_header('Content-Length', len(request.data))
General Comments 0
You need to be logged in to leave comments. Login now