mercurial/httpconnection.py
changeset 44298 0e8b28fb751b
parent 43106 d783f945a701
child 46819 d4ba4d51f85f
equal deleted inserted replaced
44297:cf1f8660e568 44298:0e8b28fb751b
    37         self.seek = self._data.seek
    37         self.seek = self._data.seek
    38         self.close = self._data.close
    38         self.close = self._data.close
    39         self.write = self._data.write
    39         self.write = self._data.write
    40         self.length = os.fstat(self._data.fileno()).st_size
    40         self.length = os.fstat(self._data.fileno()).st_size
    41         self._pos = 0
    41         self._pos = 0
       
    42         self._progress = self._makeprogress()
       
    43 
       
    44     def _makeprogress(self):
    42         # We pass double the max for total because we currently have
    45         # We pass double the max for total because we currently have
    43         # to send the bundle twice in the case of a server that
    46         # to send the bundle twice in the case of a server that
    44         # requires authentication. Since we can't know until we try
    47         # requires authentication. Since we can't know until we try
    45         # once whether authentication will be required, just lie to
    48         # once whether authentication will be required, just lie to
    46         # the user and maybe the push succeeds suddenly at 50%.
    49         # the user and maybe the push succeeds suddenly at 50%.
    47         self._progress = ui.makeprogress(
    50         return self.ui.makeprogress(
    48             _(b'sending'), unit=_(b'kb'), total=(self.length // 1024 * 2)
    51             _(b'sending'), unit=_(b'kb'), total=(self.length // 1024 * 2)
    49         )
    52         )
    50 
    53 
    51     def read(self, *args, **kwargs):
    54     def read(self, *args, **kwargs):
    52         ret = self._data.read(*args, **kwargs)
    55         ret = self._data.read(*args, **kwargs)