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

login
register
mail settings
Submitter phabricator
Date Jan. 21, 2020, 6:37 p.m.
Message ID <differential-rev-PHID-DREV-dyf6yncutz7womomglo7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44557/
State Superseded
Headers show

Comments

phabricator - Jan. 21, 2020, 6:37 p.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This will be neccessary for LFS, which manages the progressbar outside of the
  file.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/httpconnection.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 10, 2020, 9:49 p.m.
durin42 added a comment.


  In D7960#119477 <https://phab.mercurial-scm.org/D7960#119477>, @mharbison72 wrote:
  
  > In D7960#119446 <https://phab.mercurial-scm.org/D7960#119446>, @marmoute wrote:
  >
  >> (also, the double sending is very sad, could we have a small wireprotocol command dedicated at testing authentication first instead ?)
  >
  > Presumably, but IDK anything about the wire protocol, and the existing code would still be needed for the case where the server doesn't know about  the command.
  
  I looked into that for the core wireproto years ago. The summary is basically "no, httplib is a very simple http client and not readily extended." If you want to do better, you're in the bad place of doing something like using libcurl in hg, which will be very complicated. :(

REPOSITORY
  rHG Mercurial

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

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

To: mharbison72, #hg-reviewers
Cc: durin42, marmoute, mercurial-devel
phabricator - Feb. 10, 2020, 11:55 p.m.
mharbison72 added a comment.


  I forgot to reply to this last week- I was concerned when the subsequent part of the stack went in without suppressing the per file progress bars here, that the displayed progress bar would be bouncing around randomly.  But it wasn't- it was ever increasing like only the main bar was being changed.  Any ideas why that would be?

REPOSITORY
  rHG Mercurial

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

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

To: mharbison72, #hg-reviewers
Cc: durin42, marmoute, mercurial-devel
phabricator - Feb. 11, 2020, 12:25 a.m.
durin42 added a comment.


  In D7960#120242 <https://phab.mercurial-scm.org/D7960#120242>, @mharbison72 wrote:
  
  > I forgot to reply to this last week- I was concerned when the subsequent part of the stack went in without suppressing the per file progress bars here, that the displayed progress bar would be bouncing around randomly.  But it wasn't- it was ever increasing like only the main bar was being changed.  Any ideas why that would be?
  
  Progress bars have some stickiness and won't show brief sub-topics. It's all pretty configurable, but I think the default is we don't show a nested topic if it exists for less than 2 seconds of ticks of the upper level progress bar.

REPOSITORY
  rHG Mercurial

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

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

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)
         )