mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
2016586fe2
Summary: Add Python bindings to the Rust progress wrappers. This may seem pointless since the Rust code just calls right back into Python, but this is a useful step to get the Rust and Python code to use a common interface for progress. (Which, in turn, will allow switching to a Rust progress implementation down the line.) Reviewed By: markbt Differential Revision: D23999816 fbshipit-source-id: 9bca0f23170d3ca474a1cb5d547840e63572ec71
55 lines
3.7 KiB
Perl
55 lines
3.7 KiB
Perl
#chg-compatible
|
|
|
|
$ enable progress
|
|
$ setconfig extensions.rustprogresstest="$TESTDIR/rustprogresstest.py"
|
|
$ setconfig progress.delay=0 progress.changedelay=2 progress.refresh=1 progress.assume-tty=true
|
|
|
|
Test creating a progress spinner.
|
|
$ hg rustspinnertest 5
|
|
\r (no-eol) (esc)
|
|
loop 1 [ <=> ] 1.0\r (no-eol) (esc)
|
|
loop 2 [ <=> ] 2.0\r (no-eol) (esc)
|
|
loop 3 [ <=> ] 3.0\r (no-eol) (esc)
|
|
loop 4 [ <=> ] 4.0\r (no-eol) (esc)
|
|
loop 5 [ <=> ] 5.0\r (no-eol) (esc)
|
|
\r (no-eol) (esc)
|
|
|
|
Test creating a progress bar.
|
|
$ hg rustprogresstest 6 6
|
|
\r (no-eol) (esc)
|
|
loop 1 [===================> ] 1/3 03s\r (no-eol) (esc)
|
|
loop 2 [========================================> ] 2/3 02s\r (no-eol) (esc)
|
|
loop 3 [=============================================================>] 3/3 01s\r (no-eol) (esc)
|
|
loop 4 [========================================> ] 4/6 03s\r (no-eol) (esc)
|
|
loop 5 [==================================================> ] 5/6 02s\r (no-eol) (esc)
|
|
loop 6 [=============================================================>] 6/6 01s\r (no-eol) (esc)
|
|
\r (no-eol) (esc)
|
|
|
|
Test creating an indeterminate (i.e., no total) progress bar.
|
|
$ hg rustprogresstest -- 5 -1
|
|
\r (no-eol) (esc)
|
|
loop 1 [ <=> ] 1\r (no-eol) (esc)
|
|
loop 2 [ <=> ] 2\r (no-eol) (esc)
|
|
loop 3 [ <=> ] 3\r (no-eol) (esc)
|
|
loop 4 [ <=> ] 4\r (no-eol) (esc)
|
|
loop 5 [ <=> ] 5\r (no-eol) (esc)
|
|
\r (no-eol) (esc)
|
|
|
|
Test formatting the number as bytes.
|
|
Note that the first iteration is not rendered because the first value is 0.
|
|
$ hg rustbytesprogresstest
|
|
\r (no-eol) (esc)
|
|
loop 2 [ ] 10 bytes/1.03 GB 3y28w\r (no-eol) (esc)
|
|
loop 3 [ ] 250 bytes/1.03 GB 14w05d\r (no-eol) (esc)
|
|
loop 4 [ ] 999 bytes/1.03 GB 5w04d\r (no-eol) (esc)
|
|
loop 5 [ ] 1000 bytes/1.03 GB 7w03d\r (no-eol) (esc)
|
|
loop 6 [ ] 1.00 KB/1.03 GB 9w00d\r (no-eol) (esc)
|
|
loop 7 [ ] 21.5 KB/1.03 GB 3d13h\r (no-eol) (esc)
|
|
loop 8 [ ] 1.00 MB/1.03 GB 2h04m\r (no-eol) (esc)
|
|
loop 9 [ ] 1.41 MB/1.03 GB 1h41m\r (no-eol) (esc)
|
|
loop 10 [====> ] 118 MB/1.03 GB 1m13s\r (no-eol) (esc)
|
|
loop 11 [=======================> ] 530 MB/1.03 GB 11s\r (no-eol) (esc)
|
|
loop 12 [===========================================> ] 954 MB/1.03 GB 02s\r (no-eol) (esc)
|
|
loop 13 [================================================>] 1.03 GB/1.03 GB 01s\r (no-eol) (esc)
|
|
\r (no-eol) (esc)
|