annotate tests/test-progress.t @ 15261:e2df5b866d22

minirst: add basic HTML formatting support
author Matt Mackall <mpm@selenic.com>
date Sat, 15 Oct 2011 00:39:01 -0500
parents 5d261fd00446
children 695ac6aca77f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
1
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
2 $ cat > loop.py <<EOF
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
3 > from mercurial import commands
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
4 >
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
5 > def loop(ui, loops, **opts):
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
6 > loops = int(loops)
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
7 > total = None
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
8 > if loops >= 0:
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
9 > total = loops
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
10 > if opts.get('total', None):
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
11 > total = int(opts.get('total'))
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
12 > nested = False
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
13 > if opts.get('nested', None):
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
14 > nested = True
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
15 > loops = abs(loops)
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
16 >
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
17 > for i in range(loops):
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
18 > ui.progress('loop', i, 'loop.%d' % i, 'loopnum', total)
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
19 > if opts.get('parallel'):
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
20 > ui.progress('other', i, 'other.%d' % i, 'othernum', total)
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
21 > if nested:
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
22 > for j in range(2):
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
23 > ui.progress('nested', j, 'nested.%d' % j, 'nestnum', 2)
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
24 > ui.progress('nested', None, 'nested.done', 'nestnum', 2)
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
25 > ui.progress('loop', None, 'loop.done', 'loopnum', total)
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
26 >
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
27 > commands.norepo += " loop"
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
28 >
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
29 > cmdtable = {
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
30 > "loop": (loop, [('', 'total', '', 'override for total'),
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
31 > ('', 'nested', False, 'show nested results'),
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
32 > ('', 'parallel', False, 'show parallel sets of results'),
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
33 > ],
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
34 > 'hg loop LOOPS'),
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
35 > }
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
36 > EOF
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
37
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
38 $ echo "[extensions]" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
39 $ echo "progress=" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
40 $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
41 $ echo "[progress]" >> $HGRCPATH
13149
735dd8e8a208 progress using tests: disable time estimates to avoid flakiness
Augie Fackler <durin42@gmail.com>
parents: 13145
diff changeset
42 $ echo "format = topic bar number" >> $HGRCPATH
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
43 $ echo "assume-tty=1" >> $HGRCPATH
13142
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
44 $ echo "width=60" >> $HGRCPATH
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
45
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
46 test default params, display nothing because of delay
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
47
13141
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
48 $ hg -y loop 3 2>&1 | $TESTDIR/filtercr.py
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
49
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
50 $ echo "delay=0" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
51 $ echo "refresh=0" >> $HGRCPATH
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
52
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
53 test with delay=0, refresh=0
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
54
13141
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
55 $ hg -y loop 3 2>&1 | $TESTDIR/filtercr.py
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
56
13142
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
57 loop [ ] 0/3
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
58 loop [===============> ] 1/3
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
59 loop [===============================> ] 2/3
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
60 \r (esc)
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
61
14838
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
62
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
63 test nested short-lived topics (which shouldn't display with nestdelay):
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
64
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
65 $ hg -y loop 3 --nested 2>&1 | \
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
66 > python $TESTDIR/filtercr.py
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
67
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
68 loop [ ] 0/3
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
69 loop [===============> ] 1/3
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
70 loop [===============================> ] 2/3
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
71 \r (esc)
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
72
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
73
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
74 $ hg --config progress.changedelay=0 -y loop 3 --nested 2>&1 | \
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
75 > python $TESTDIR/filtercr.py
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
76
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
77 loop [ ] 0/3
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
78 nested [ ] 0/2
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
79 nested [======================> ] 1/2
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
80 loop [===============> ] 1/3
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
81 nested [ ] 0/2
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
82 nested [======================> ] 1/2
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
83 loop [===============================> ] 2/3
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
84 nested [ ] 0/2
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
85 nested [======================> ] 1/2
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
86 \r (esc)
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
87
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
88
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
89 test two topics being printed in parallel (as when we're doing a local
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
90 --pull clone, where you get the unbundle and bundle progress at the
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
91 same time):
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
92 $ hg loop 3 --parallel 2>&1 | python $TESTDIR/filtercr.py
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
93
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
94 loop [ ] 0/3
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
95 loop [===============> ] 1/3
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
96 loop [===============================> ] 2/3
5d261fd00446 progress: add a changedelay to prevent parallel topics from flapping (issue2698)
Augie Fackler <durin42@gmail.com>
parents: 13236
diff changeset
97 \r (esc)
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
98 test refresh is taken in account
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
99
13141
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
100 $ hg -y --config progress.refresh=100 loop 3 2>&1 | $TESTDIR/filtercr.py
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
101
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
102
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
103 test format options 1
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
104
13141
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
105 $ hg -y --config 'progress.format=number topic item+2' loop 2 2>&1 \
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
106 > | $TESTDIR/filtercr.py
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
107
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
108 0/2 loop lo
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
109 1/2 loop lo
13142
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
110 \r (esc)
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
111
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
112 test format options 2
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
113
13141
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
114 $ hg -y --config 'progress.format=number item-3 bar' loop 2 2>&1 \
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
115 > | $TESTDIR/filtercr.py
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
116
13142
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
117 0/2 p.0 [ ]
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
118 1/2 p.1 [=======================> ]
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
119 \r (esc)
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
120
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
121 test format options and indeterminate progress
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
122
13141
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
123 $ hg -y --config 'progress.format=number item bar' loop -- -2 2>&1 \
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
124 > | $TESTDIR/filtercr.py
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
125
13142
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
126 0 loop.0 [ <=> ]
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
127 1 loop.1 [ <=> ]
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
128 \r (esc)
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
129
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
130 make sure things don't fall over if count > total
10465
5d7e84e7ac6d Add test for progress extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
131
13141
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
132 $ hg -y loop --total 4 6 2>&1 | $TESTDIR/filtercr.py
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
133
13142
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
134 loop [ ] 0/4
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
135 loop [===========> ] 1/4
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
136 loop [=======================> ] 2/4
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
137 loop [===================================> ] 3/4
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
138 loop [===============================================>] 4/4
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
139 loop [ <=> ] 5/4
e9827c85c50b progress: test setting progress.width
Martin Geisler <mg@aragost.com>
parents: 13141
diff changeset
140 \r (esc)
10891
83af68e38be3 progress: fall back to indeterminate progress if position is >= total
Augie Fackler <durin42@gmail.com>
parents: 10788
diff changeset
141
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
142 test immediate progress completion
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
143
13141
6cfe17c19ba2 tests: add filtercr.py helper for progress tests
Martin Geisler <mg@aragost.com>
parents: 12942
diff changeset
144 $ hg -y loop 0 2>&1 | $TESTDIR/filtercr.py
12479
2f9ef3657730 tests: unify test-progress
Matt Mackall <mpm@selenic.com>
parents: 10891
diff changeset
145
13145
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
146
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
147 test delay time estimates
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
148
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
149 $ cat > mocktime.py <<EOF
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
150 > import os
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
151 > import time
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
152 >
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
153 > class mocktime(object):
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
154 > def __init__(self, increment):
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
155 > self.time = 0
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
156 > self.increment = increment
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
157 > def __call__(self):
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
158 > self.time += self.increment
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
159 > return self.time
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
160 >
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
161 > def uisetup(ui):
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
162 > time.time = mocktime(int(os.environ.get('MOCKTIME', '11')))
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
163 > EOF
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
164
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
165 $ echo "[extensions]" > $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
166 $ echo "mocktime=`pwd`/mocktime.py" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
167 $ echo "progress=" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
168 $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
169 $ echo "[progress]" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
170 $ echo "assume-tty=1" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
171 $ echo "delay=25" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
172 $ echo "width=60" >> $HGRCPATH
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
173
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
174 $ hg -y loop 8 2>&1 | python $TESTDIR/filtercr.py
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
175
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
176 loop [=========> ] 2/8 1m07s
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
177 loop [===============> ] 3/8 56s
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
178 loop [=====================> ] 4/8 45s
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
179 loop [==========================> ] 5/8 34s
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
180 loop [================================> ] 6/8 23s
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
181 loop [=====================================> ] 7/8 12s
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
182 \r (esc)
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
183
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
184 $ MOCKTIME=10000 hg -y loop 4 2>&1 | python $TESTDIR/filtercr.py
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
185
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
186 loop [ ] 0/4
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
187 loop [=========> ] 1/4 8h21m
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
188 loop [====================> ] 2/4 5h34m
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
189 loop [==============================> ] 3/4 2h47m
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
190 \r (esc)
ce4cd176634e test-progress: test completion estimates and progress bar delay
Augie Fackler <durin42@gmail.com>
parents: 13142
diff changeset
191
13236
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
192 $ MOCKTIME=1000000 hg -y loop 4 2>&1 | python $TESTDIR/filtercr.py
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
193
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
194 loop [ ] 0/4
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
195 loop [=========> ] 1/4 5w00d
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
196 loop [====================> ] 2/4 3w03d
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
197 loop [=============================> ] 3/4 11d14h
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
198 \r (esc)
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
199
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
200
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
201 $ MOCKTIME=14000000 hg -y loop 4 2>&1 | python $TESTDIR/filtercr.py
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
202
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
203 loop [ ] 0/4
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
204 loop [=========> ] 1/4 1y18w
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
205 loop [===================> ] 2/4 46w03d
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
206 loop [=============================> ] 3/4 23w02d
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
207 \r (esc)
3f299f5d9a29 progress: handle days, weeks and years
timeless <timeless@gmail.com>
parents: 13154
diff changeset
208
13154
e11c14f14491 progress: don't compute estimate without a total
Augie Fackler <durin42@gmail.com>
parents: 13149
diff changeset
209 Time estimates should not fail when there's no end point:
e11c14f14491 progress: don't compute estimate without a total
Augie Fackler <durin42@gmail.com>
parents: 13149
diff changeset
210 $ hg -y loop -- -4 2>&1 | python $TESTDIR/filtercr.py
e11c14f14491 progress: don't compute estimate without a total
Augie Fackler <durin42@gmail.com>
parents: 13149
diff changeset
211
e11c14f14491 progress: don't compute estimate without a total
Augie Fackler <durin42@gmail.com>
parents: 13149
diff changeset
212 loop [ <=> ] 2
e11c14f14491 progress: don't compute estimate without a total
Augie Fackler <durin42@gmail.com>
parents: 13149
diff changeset
213 loop [ <=> ] 3
e11c14f14491 progress: don't compute estimate without a total
Augie Fackler <durin42@gmail.com>
parents: 13149
diff changeset
214 \r (esc)