Show More
@@ -38,21 +38,21 b' class httpsendfile(object):' | |||
|
38 | 38 | self.write = self._data.write |
|
39 | 39 | self.length = os.fstat(self._data.fileno()).st_size |
|
40 | 40 | self._pos = 0 |
|
41 | self._total = self.length // 1024 * 2 | |
|
42 | ||
|
43 | def read(self, *args, **kwargs): | |
|
44 | ret = self._data.read(*args, **kwargs) | |
|
45 | if not ret: | |
|
46 | self.ui.progress(_('sending'), None) | |
|
47 | return ret | |
|
48 | self._pos += len(ret) | |
|
49 | 41 | # We pass double the max for total because we currently have |
|
50 | 42 | # to send the bundle twice in the case of a server that |
|
51 | 43 | # requires authentication. Since we can't know until we try |
|
52 | 44 | # once whether authentication will be required, just lie to |
|
53 | 45 | # the user and maybe the push succeeds suddenly at 50%. |
|
54 |
self.ui.progress(_('sending'), |
|
|
55 |
|
|
|
46 | self._progress = ui.makeprogress(_('sending'), unit=_('kb'), | |
|
47 | total=(self.length // 1024 * 2)) | |
|
48 | ||
|
49 | def read(self, *args, **kwargs): | |
|
50 | ret = self._data.read(*args, **kwargs) | |
|
51 | if not ret: | |
|
52 | self._progress.complete() | |
|
53 | return ret | |
|
54 | self._pos += len(ret) | |
|
55 | self._progress.update(self._pos // 1024) | |
|
56 | 56 | return ret |
|
57 | 57 | |
|
58 | 58 | def __enter__(self): |
General Comments 0
You need to be logged in to leave comments.
Login now