Patchwork D6843: ui: option to preserve the progress bar

login
register
mail settings
Submitter phabricator
Date Oct. 16, 2019, 9:05 p.m.
Message ID <640f160575877cfd79dbf0d53271c54b@localhost.localdomain>
Download mbox | patch
Permalink /patch/42428/
State Not Applicable
Headers show

Comments

phabricator - Oct. 16, 2019, 9:05 p.m.
Closed by commit rHGcf25e525b7ae: ui: option to preserve the progress bar (authored by joerg.sonnenberger).
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/D6843?vs=17154&id=17261

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

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

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers, indygreg
Cc: indygreg, durin42, mercurial-devel

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1072,6 +1072,13 @@ 
         Label names take the form of "topic.type". For example, ui.debug()
         issues a label of "ui.debug".
 
+        Progress reports via stderr are normally cleared before writing as
+        stdout and stderr go to the same terminal. This can be skipped with
+        the optional keyword argument "keepprogressbar". The progress bar
+        will continue to occupy a partial line on stderr in that case.
+        This functionality is intended when Mercurial acts as data source
+        in a pipe.
+
         When labeling output for a specific command, a label of
         "cmdname.type" is recommended. For example, status issues
         a label of "status.modified" for modified files.
@@ -1087,8 +1094,9 @@ 
                 self._buffers[-1].extend(args)
             return
 
-        # inliend _writenobuf() for speed
-        self._progclear()
+        # inlined _writenobuf() for speed
+        if not opts.get(r'keepprogressbar', False):
+            self._progclear()
         msg = b''.join(args)
 
         # opencode timeblockedsection because this is a critical path
@@ -1126,7 +1134,8 @@ 
 
     def _writenobuf(self, dest, *args, **opts):
         # update write() as well if you touch this code
-        self._progclear()
+        if not opts.get(r'keepprogressbar', False):
+            self._progclear()
         msg = b''.join(args)
 
         # opencode timeblockedsection because this is a critical path