ok/jj
1
0
Fork 0
forked from mirrors/jj
Commit graph

18 commits

Author SHA1 Message Date
Yuya Nishihara
bea1ef73e6 ui: create separate io wrapper for progress output
I'm going to redirect progress message to stderr, but the current Ui API
makes it less clear whether the underlying streams of .write*()/.flush()/
.output_guard() are related or not.
2023-06-13 21:50:01 +09:00
Yuya Nishihara
1b0feb913d progress: use common duration constants
New update interval is 33ms, but I don't think that would matter.
2023-06-13 21:38:32 +09:00
Yuya Nishihara
6c1e39f3ff ui: ensure progress completion output is flushed
Since stdout is wrapped with LineWriter, we need to explicitly flush the
output. Otherwise the snapshot progress would persist until newline character
is printed.

It might also be better to send progress to stderr?
2023-06-12 20:21:17 +09:00
Martin von Zweigbergk
7bf1ab712a progress: update progress only every 10 ms
In the Linux repo, this speeds up `jj diff` in a clean working copy
from 1.41 s to 881 ms.
2023-05-26 12:22:29 -07:00
Tal Pressman
d038926714 trim snapshot progress output 2023-05-11 13:26:42 +09:00
Benjamin Saunders
eeeb7ed234 cli: report snapshot progress after first 250ms 2023-05-06 11:07:46 -07:00
Martin von Zweigbergk
ac27cdea69 cli: include total downloaded size in progress output
With this change, the output looks like this:

```
  3% 165.9 Mi at  13.4 MiB/s [█▋                                                   ]
```

Closes #1483.
2023-04-05 06:21:32 -07:00
Yuya Nishihara
afdf9e19f2 ui: simplify size() to only return width, rename it to term_width()
I'm going to add $COLUMNS override, and it should work even if ioctl() on tty
failed. This means that the return type has to be (Option<u16>, Option<u16>).
Since we don't use the row count, I decided to drop it.
2023-03-11 12:01:17 +09:00
Martin von Zweigbergk
7f9a0a2820 cleanup: let new Clippy move variables into format strings
I ran an upgraded Clippy on the codebase. All the changes seem to be
about using variables directly in format strings instead of passing
them as separate arguments.
2022-12-14 21:30:58 -08:00
Benjamin Saunders
46fe0791e8 cli: fix rebase error 2022-11-06 18:50:58 -08:00
Benjamin Saunders
210b54afd7 cli: hide cursor during progress display 2022-11-06 18:15:22 -08:00
Benjamin Saunders
135e4d64dd cli: clean up progress error handling 2022-11-06 17:31:29 -08:00
Benjamin Saunders
fd0a065801 cli: remove lifetime from Progress 2022-11-06 17:31:29 -08:00
Martin von Zweigbergk
95638d453c progress: use clamp() for readability
This was actually what I meant in my code-review comment but I used
the wrong word ("clip") :) I wasn't going to bother changing it, but
Clippy nightly just started warning about it.
2022-10-27 17:47:12 -07:00
Benjamin Saunders
78f2de20f0 cli: erase progress feedback on completion 2022-10-24 12:52:41 -07:00
Benjamin Saunders
e773709e31 cli: draw bar in progress report 2022-10-24 12:52:41 -07:00
Benjamin Saunders
3dd2cbf799 cli: limit progress report update rate 2022-10-24 12:52:41 -07:00
Benjamin Saunders
f11b3d2476 cli: factor progress reporting out into its own module 2022-10-24 12:52:41 -07:00