Patchwork D7960: httpconnection: allow `httpsendfile` subclasses to suppress the progressbar

login
register
mail settings
Submitter phabricator
Date Feb. 10, 2020, 10:01 p.m.
Message ID <0571529b630ef935525d7f0362ee1619@localhost.localdomain>
Download mbox | patch
Permalink /patch/45086/
State Not Applicable
Headers show

Comments

phabricator - Feb. 10, 2020, 10:01 p.m.
Closed by commit rHG0e8b28fb751b: httpconnection: allow `httpsendfile` subclasses to suppress the progressbar (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7960?vs=19494&id=20066

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7960/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7960

AFFECTED FILES
  mercurial/httpconnection.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: durin42, marmoute, mercurial-devel

Patch

diff --git a/mercurial/httpconnection.py b/mercurial/httpconnection.py
--- a/mercurial/httpconnection.py
+++ b/mercurial/httpconnection.py
@@ -39,12 +39,15 @@ 
         self.write = self._data.write
         self.length = os.fstat(self._data.fileno()).st_size
         self._pos = 0
+        self._progress = self._makeprogress()
+
+    def _makeprogress(self):
         # We pass double the max for total because we currently have
         # to send the bundle twice in the case of a server that
         # requires authentication. Since we can't know until we try
         # once whether authentication will be required, just lie to
         # the user and maybe the push succeeds suddenly at 50%.
-        self._progress = ui.makeprogress(
+        return self.ui.makeprogress(
             _(b'sending'), unit=_(b'kb'), total=(self.length // 1024 * 2)
         )