Page MenuHomePhabricator

ui: option to preserve the progress bar

Authored by joerg.sonnenberger on Sep 11 2019, 9:41 PM.



Some interface like the fast-import format of git are meant for pipe
processing. It can be still desirable to have progress bars in this
case, but clearing the bar after each output operation is not desirable.

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Shouldn't we print a newline to preserve the progress bar? I guess I'm not following the logic.

The goal here is to allow something like "hg fast-export | git fast-import" to show a proper progress bar.
At the moment every write via ui.write and friends will hide the progress bar and re-enable it, even when stdout doesn't affect the terminal state. This would also make sense for operations like "hg diff", e.g. when writing a large/complicated diff to a file.

indygreg requested changes to this revision.Oct 5 2019, 3:39 PM
indygreg added a subscriber: indygreg.

I think this is a useful feature. I've wanted this in automated environment so the last state from the progress bar is preserved, for example.

But I agree with Augie that I believe we need to print a newline if we're keeping the progress bar because at the point we print the progress bar, the cursor is at the end of the progress bar.

Also, the printing of the line needs to be abstracted and performed in the progress bar implementation. I would check the config option in _progclear() and pass the value to clear() and it can determine if it needs to print a \n or what.

This revision now requires changes to proceed.Oct 5 2019, 3:39 PM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.