# HG changeset patch # User Augie Fackler # Date 2015-09-26 04:10:48 # Node ID 72bccc1f26b1a2e88243c8964781c2e0aaf0a978 # Parent 2cac6126329f681e451c54c74db99fbc3f2a81fa progress: force a repaint of a printed progress bar after a clear() This avoids some visual flickering of the progress bar in convert and probably some other operations. Previously, a line of output would erase the progress bar, and then it would wait `progress.refresh` seconds (default of 0.1) before redrawing the progress bar. Now if we've ever painted a progress bar, we schedule the progress bar for immediate repainting on the next progress call, which helps lend the illusion that the progress bar is "always" there. In practice, it's merely there more of the time, but it ends up being a lot easier to read during convert. diff --git a/mercurial/progress.py b/mercurial/progress.py --- a/mercurial/progress.py +++ b/mercurial/progress.py @@ -166,6 +166,9 @@ class progbar(object): if not shouldprint(self.ui): return sys.stderr.write('\r%s\r' % (' ' * self.width())) + if self.printed: + # force immediate re-paint of progress bar + self.lastprint = 0 def complete(self): if not shouldprint(self.ui):