Show More
@@ -1,361 +1,363 b'' | |||||
1 |
|
1 | |||
2 | $ cat > loop.py <<EOF |
|
2 | $ cat > loop.py <<EOF | |
3 | > from __future__ import absolute_import |
|
3 | > from __future__ import absolute_import | |
4 | > import time |
|
4 | > import time | |
5 | > from mercurial import commands, registrar |
|
5 | > from mercurial import commands, registrar | |
6 | > |
|
6 | > | |
7 | > cmdtable = {} |
|
7 | > cmdtable = {} | |
8 | > command = registrar.command(cmdtable) |
|
8 | > command = registrar.command(cmdtable) | |
9 | > |
|
9 | > | |
10 | > class incrementingtime(object): |
|
10 | > class incrementingtime(object): | |
11 | > def __init__(self): |
|
11 | > def __init__(self): | |
12 | > self._time = 0.0 |
|
12 | > self._time = 0.0 | |
13 | > def __call__(self): |
|
13 | > def __call__(self): | |
14 | > self._time += 0.25 |
|
14 | > self._time += 0.25 | |
15 | > return self._time |
|
15 | > return self._time | |
16 | > time.time = incrementingtime() |
|
16 | > time.time = incrementingtime() | |
17 | > |
|
17 | > | |
18 | > @command(b'loop', |
|
18 | > @command(b'loop', | |
19 | > [(b'', b'total', b'', b'override for total'), |
|
19 | > [(b'', b'total', b'', b'override for total'), | |
20 | > (b'', b'nested', False, b'show nested results'), |
|
20 | > (b'', b'nested', False, b'show nested results'), | |
21 | > (b'', b'parallel', False, b'show parallel sets of results')], |
|
21 | > (b'', b'parallel', False, b'show parallel sets of results')], | |
22 | > b'hg loop LOOPS', |
|
22 | > b'hg loop LOOPS', | |
23 | > norepo=True) |
|
23 | > norepo=True) | |
24 | > def loop(ui, loops, **opts): |
|
24 | > def loop(ui, loops, **opts): | |
25 | > loops = int(loops) |
|
25 | > loops = int(loops) | |
26 | > total = None |
|
26 | > total = None | |
27 | > if loops >= 0: |
|
27 | > if loops >= 0: | |
28 | > total = loops |
|
28 | > total = loops | |
29 | > if opts.get('total', None): |
|
29 | > if opts.get('total', None): | |
30 | > total = int(opts.get('total')) |
|
30 | > total = int(opts.get('total')) | |
31 | > nested = False |
|
31 | > nested = False | |
32 | > if opts.get('nested', None): |
|
32 | > if opts.get('nested', None): | |
33 | > nested = True |
|
33 | > nested = True | |
34 | > loops = abs(loops) |
|
34 | > loops = abs(loops) | |
35 | > |
|
35 | > | |
|
36 | > progress = ui.makeprogress(topiclabel, unit='loopnum', total=total) | |||
|
37 | > other = ui.makeprogress('other', unit='othernum', total=total) | |||
36 | > for i in range(loops): |
|
38 | > for i in range(loops): | |
37 |
> |
|
39 | > progress.update(i, item=getloopitem(i)) | |
38 | > if opts.get('parallel'): |
|
40 | > if opts.get('parallel'): | |
39 |
> |
|
41 | > other.update(i, item='other.%d' % i) | |
40 | > if nested: |
|
42 | > if nested: | |
41 | > nested_steps = 2 |
|
43 | > nested_steps = 2 | |
42 | > if i and i % 4 == 0: |
|
44 | > if i and i % 4 == 0: | |
43 | > nested_steps = 5 |
|
45 | > nested_steps = 5 | |
|
46 | > nested = ui.makeprogress('nested', unit='nestnum', | |||
|
47 | > total=nested_steps) | |||
44 | > for j in range(nested_steps): |
|
48 | > for j in range(nested_steps): | |
45 | > ui.progress( |
|
49 | > nested.update(j, item='nested.%d' % j) | |
46 | > 'nested', j, 'nested.%d' % j, 'nestnum', nested_steps) |
|
50 | > nested.complete() | |
47 |
> |
|
51 | > progress.complete() | |
48 | > 'nested', None, 'nested.done', 'nestnum', nested_steps) |
|
|||
49 | > ui.progress(topiclabel, None, 'loop.done', 'loopnum', total) |
|
|||
50 | > |
|
52 | > | |
51 | > topiclabel = 'loop' |
|
53 | > topiclabel = 'loop' | |
52 | > def getloopitem(i): |
|
54 | > def getloopitem(i): | |
53 | > return 'loop.%d' % i |
|
55 | > return 'loop.%d' % i | |
54 | > |
|
56 | > | |
55 | > EOF |
|
57 | > EOF | |
56 |
|
58 | |||
57 | $ cp $HGRCPATH $HGRCPATH.orig |
|
59 | $ cp $HGRCPATH $HGRCPATH.orig | |
58 | $ echo "[extensions]" >> $HGRCPATH |
|
60 | $ echo "[extensions]" >> $HGRCPATH | |
59 | $ echo "progress=" >> $HGRCPATH |
|
61 | $ echo "progress=" >> $HGRCPATH | |
60 | $ echo "loop=`pwd`/loop.py" >> $HGRCPATH |
|
62 | $ echo "loop=`pwd`/loop.py" >> $HGRCPATH | |
61 | $ echo "[progress]" >> $HGRCPATH |
|
63 | $ echo "[progress]" >> $HGRCPATH | |
62 | $ echo "format = topic bar number" >> $HGRCPATH |
|
64 | $ echo "format = topic bar number" >> $HGRCPATH | |
63 | $ echo "assume-tty=1" >> $HGRCPATH |
|
65 | $ echo "assume-tty=1" >> $HGRCPATH | |
64 | $ echo "width=60" >> $HGRCPATH |
|
66 | $ echo "width=60" >> $HGRCPATH | |
65 |
|
67 | |||
66 | test default params, display nothing because of delay |
|
68 | test default params, display nothing because of delay | |
67 |
|
69 | |||
68 | $ hg -y loop 3 |
|
70 | $ hg -y loop 3 | |
69 | $ echo "delay=0" >> $HGRCPATH |
|
71 | $ echo "delay=0" >> $HGRCPATH | |
70 | $ echo "refresh=0" >> $HGRCPATH |
|
72 | $ echo "refresh=0" >> $HGRCPATH | |
71 |
|
73 | |||
72 | test with delay=0, refresh=0 |
|
74 | test with delay=0, refresh=0 | |
73 |
|
75 | |||
74 | $ hg -y loop 3 |
|
76 | $ hg -y loop 3 | |
75 | \r (no-eol) (esc) |
|
77 | \r (no-eol) (esc) | |
76 | loop [ ] 0/3\r (no-eol) (esc) |
|
78 | loop [ ] 0/3\r (no-eol) (esc) | |
77 | loop [===============> ] 1/3\r (no-eol) (esc) |
|
79 | loop [===============> ] 1/3\r (no-eol) (esc) | |
78 | loop [===============================> ] 2/3\r (no-eol) (esc) |
|
80 | loop [===============================> ] 2/3\r (no-eol) (esc) | |
79 | \r (no-eol) (esc) |
|
81 | \r (no-eol) (esc) | |
80 | no progress with --quiet |
|
82 | no progress with --quiet | |
81 | $ hg -y loop 3 --quiet |
|
83 | $ hg -y loop 3 --quiet | |
82 |
|
84 | |||
83 | test plain mode exception |
|
85 | test plain mode exception | |
84 | $ HGPLAINEXCEPT=progress hg -y loop 1 |
|
86 | $ HGPLAINEXCEPT=progress hg -y loop 1 | |
85 | \r (no-eol) (esc) |
|
87 | \r (no-eol) (esc) | |
86 | loop [ ] 0/1\r (no-eol) (esc) |
|
88 | loop [ ] 0/1\r (no-eol) (esc) | |
87 | \r (no-eol) (esc) |
|
89 | \r (no-eol) (esc) | |
88 |
|
90 | |||
89 | test nested short-lived topics (which shouldn't display with nestdelay): |
|
91 | test nested short-lived topics (which shouldn't display with nestdelay): | |
90 |
|
92 | |||
91 | $ hg -y loop 3 --nested |
|
93 | $ hg -y loop 3 --nested | |
92 | \r (no-eol) (esc) |
|
94 | \r (no-eol) (esc) | |
93 | loop [ ] 0/3\r (no-eol) (esc) |
|
95 | loop [ ] 0/3\r (no-eol) (esc) | |
94 | loop [===============> ] 1/3\r (no-eol) (esc) |
|
96 | loop [===============> ] 1/3\r (no-eol) (esc) | |
95 | loop [===============================> ] 2/3\r (no-eol) (esc) |
|
97 | loop [===============================> ] 2/3\r (no-eol) (esc) | |
96 | \r (no-eol) (esc) |
|
98 | \r (no-eol) (esc) | |
97 |
|
99 | |||
98 | Test nested long-lived topic which has the same name as a short-lived |
|
100 | Test nested long-lived topic which has the same name as a short-lived | |
99 | peer. We shouldn't get stuck showing the short-lived inner steps, and |
|
101 | peer. We shouldn't get stuck showing the short-lived inner steps, and | |
100 | should go back to skipping the inner steps when the slow nested step |
|
102 | should go back to skipping the inner steps when the slow nested step | |
101 | finishes. |
|
103 | finishes. | |
102 |
|
104 | |||
103 | $ hg -y loop 7 --nested |
|
105 | $ hg -y loop 7 --nested | |
104 | \r (no-eol) (esc) |
|
106 | \r (no-eol) (esc) | |
105 | loop [ ] 0/7\r (no-eol) (esc) |
|
107 | loop [ ] 0/7\r (no-eol) (esc) | |
106 | loop [=====> ] 1/7\r (no-eol) (esc) |
|
108 | loop [=====> ] 1/7\r (no-eol) (esc) | |
107 | loop [============> ] 2/7\r (no-eol) (esc) |
|
109 | loop [============> ] 2/7\r (no-eol) (esc) | |
108 | loop [===================> ] 3/7\r (no-eol) (esc) |
|
110 | loop [===================> ] 3/7\r (no-eol) (esc) | |
109 | loop [==========================> ] 4/7\r (no-eol) (esc) |
|
111 | loop [==========================> ] 4/7\r (no-eol) (esc) | |
110 | nested [==========================> ] 3/5\r (no-eol) (esc) |
|
112 | nested [==========================> ] 3/5\r (no-eol) (esc) | |
111 | nested [===================================> ] 4/5\r (no-eol) (esc) |
|
113 | nested [===================================> ] 4/5\r (no-eol) (esc) | |
112 | loop [=================================> ] 5/7\r (no-eol) (esc) |
|
114 | loop [=================================> ] 5/7\r (no-eol) (esc) | |
113 | loop [========================================> ] 6/7\r (no-eol) (esc) |
|
115 | loop [========================================> ] 6/7\r (no-eol) (esc) | |
114 | \r (no-eol) (esc) |
|
116 | \r (no-eol) (esc) | |
115 |
|
117 | |||
116 |
|
118 | |||
117 | $ hg --config progress.changedelay=0 -y loop 3 --nested |
|
119 | $ hg --config progress.changedelay=0 -y loop 3 --nested | |
118 | \r (no-eol) (esc) |
|
120 | \r (no-eol) (esc) | |
119 | loop [ ] 0/3\r (no-eol) (esc) |
|
121 | loop [ ] 0/3\r (no-eol) (esc) | |
120 | nested [ ] 0/2\r (no-eol) (esc) |
|
122 | nested [ ] 0/2\r (no-eol) (esc) | |
121 | nested [======================> ] 1/2\r (no-eol) (esc) |
|
123 | nested [======================> ] 1/2\r (no-eol) (esc) | |
122 | loop [===============> ] 1/3\r (no-eol) (esc) |
|
124 | loop [===============> ] 1/3\r (no-eol) (esc) | |
123 | nested [ ] 0/2\r (no-eol) (esc) |
|
125 | nested [ ] 0/2\r (no-eol) (esc) | |
124 | nested [======================> ] 1/2\r (no-eol) (esc) |
|
126 | nested [======================> ] 1/2\r (no-eol) (esc) | |
125 | loop [===============================> ] 2/3\r (no-eol) (esc) |
|
127 | loop [===============================> ] 2/3\r (no-eol) (esc) | |
126 | nested [ ] 0/2\r (no-eol) (esc) |
|
128 | nested [ ] 0/2\r (no-eol) (esc) | |
127 | nested [======================> ] 1/2\r (no-eol) (esc) |
|
129 | nested [======================> ] 1/2\r (no-eol) (esc) | |
128 | \r (no-eol) (esc) |
|
130 | \r (no-eol) (esc) | |
129 |
|
131 | |||
130 |
|
132 | |||
131 | test two topics being printed in parallel (as when we're doing a local |
|
133 | test two topics being printed in parallel (as when we're doing a local | |
132 | --pull clone, where you get the unbundle and bundle progress at the |
|
134 | --pull clone, where you get the unbundle and bundle progress at the | |
133 | same time): |
|
135 | same time): | |
134 | $ hg loop 3 --parallel |
|
136 | $ hg loop 3 --parallel | |
135 | \r (no-eol) (esc) |
|
137 | \r (no-eol) (esc) | |
136 | loop [ ] 0/3\r (no-eol) (esc) |
|
138 | loop [ ] 0/3\r (no-eol) (esc) | |
137 | loop [===============> ] 1/3\r (no-eol) (esc) |
|
139 | loop [===============> ] 1/3\r (no-eol) (esc) | |
138 | loop [===============================> ] 2/3\r (no-eol) (esc) |
|
140 | loop [===============================> ] 2/3\r (no-eol) (esc) | |
139 | \r (no-eol) (esc) |
|
141 | \r (no-eol) (esc) | |
140 | test refresh is taken in account |
|
142 | test refresh is taken in account | |
141 |
|
143 | |||
142 | $ hg -y --config progress.refresh=100 loop 3 |
|
144 | $ hg -y --config progress.refresh=100 loop 3 | |
143 |
|
145 | |||
144 | test format options 1 |
|
146 | test format options 1 | |
145 |
|
147 | |||
146 | $ hg -y --config 'progress.format=number topic item+2' loop 2 |
|
148 | $ hg -y --config 'progress.format=number topic item+2' loop 2 | |
147 | \r (no-eol) (esc) |
|
149 | \r (no-eol) (esc) | |
148 | 0/2 loop lo\r (no-eol) (esc) |
|
150 | 0/2 loop lo\r (no-eol) (esc) | |
149 | 1/2 loop lo\r (no-eol) (esc) |
|
151 | 1/2 loop lo\r (no-eol) (esc) | |
150 | \r (no-eol) (esc) |
|
152 | \r (no-eol) (esc) | |
151 |
|
153 | |||
152 | test format options 2 |
|
154 | test format options 2 | |
153 |
|
155 | |||
154 | $ hg -y --config 'progress.format=number item-3 bar' loop 2 |
|
156 | $ hg -y --config 'progress.format=number item-3 bar' loop 2 | |
155 | \r (no-eol) (esc) |
|
157 | \r (no-eol) (esc) | |
156 | 0/2 p.0 [ ]\r (no-eol) (esc) |
|
158 | 0/2 p.0 [ ]\r (no-eol) (esc) | |
157 | 1/2 p.1 [=======================> ]\r (no-eol) (esc) |
|
159 | 1/2 p.1 [=======================> ]\r (no-eol) (esc) | |
158 | \r (no-eol) (esc) |
|
160 | \r (no-eol) (esc) | |
159 |
|
161 | |||
160 | test format options and indeterminate progress |
|
162 | test format options and indeterminate progress | |
161 |
|
163 | |||
162 | $ hg -y --config 'progress.format=number item bar' loop -- -2 |
|
164 | $ hg -y --config 'progress.format=number item bar' loop -- -2 | |
163 | \r (no-eol) (esc) |
|
165 | \r (no-eol) (esc) | |
164 | 0 loop.0 [ <=> ]\r (no-eol) (esc) |
|
166 | 0 loop.0 [ <=> ]\r (no-eol) (esc) | |
165 | 1 loop.1 [ <=> ]\r (no-eol) (esc) |
|
167 | 1 loop.1 [ <=> ]\r (no-eol) (esc) | |
166 | \r (no-eol) (esc) |
|
168 | \r (no-eol) (esc) | |
167 |
|
169 | |||
168 | make sure things don't fall over if count > total |
|
170 | make sure things don't fall over if count > total | |
169 |
|
171 | |||
170 | $ hg -y loop --total 4 6 |
|
172 | $ hg -y loop --total 4 6 | |
171 | \r (no-eol) (esc) |
|
173 | \r (no-eol) (esc) | |
172 | loop [ ] 0/4\r (no-eol) (esc) |
|
174 | loop [ ] 0/4\r (no-eol) (esc) | |
173 | loop [===========> ] 1/4\r (no-eol) (esc) |
|
175 | loop [===========> ] 1/4\r (no-eol) (esc) | |
174 | loop [=======================> ] 2/4\r (no-eol) (esc) |
|
176 | loop [=======================> ] 2/4\r (no-eol) (esc) | |
175 | loop [===================================> ] 3/4\r (no-eol) (esc) |
|
177 | loop [===================================> ] 3/4\r (no-eol) (esc) | |
176 | loop [===============================================>] 4/4\r (no-eol) (esc) |
|
178 | loop [===============================================>] 4/4\r (no-eol) (esc) | |
177 | loop [ <=> ] 5/4\r (no-eol) (esc) |
|
179 | loop [ <=> ] 5/4\r (no-eol) (esc) | |
178 | \r (no-eol) (esc) |
|
180 | \r (no-eol) (esc) | |
179 |
|
181 | |||
180 | test immediate progress completion |
|
182 | test immediate progress completion | |
181 |
|
183 | |||
182 | $ hg -y loop 0 |
|
184 | $ hg -y loop 0 | |
183 |
|
185 | |||
184 | test delay time estimates |
|
186 | test delay time estimates | |
185 |
|
187 | |||
186 | #if no-chg |
|
188 | #if no-chg | |
187 |
|
189 | |||
188 | $ cp $HGRCPATH.orig $HGRCPATH |
|
190 | $ cp $HGRCPATH.orig $HGRCPATH | |
189 | $ echo "[extensions]" >> $HGRCPATH |
|
191 | $ echo "[extensions]" >> $HGRCPATH | |
190 | $ echo "mocktime=$TESTDIR/mocktime.py" >> $HGRCPATH |
|
192 | $ echo "mocktime=$TESTDIR/mocktime.py" >> $HGRCPATH | |
191 | $ echo "progress=" >> $HGRCPATH |
|
193 | $ echo "progress=" >> $HGRCPATH | |
192 | $ echo "loop=`pwd`/loop.py" >> $HGRCPATH |
|
194 | $ echo "loop=`pwd`/loop.py" >> $HGRCPATH | |
193 | $ echo "[progress]" >> $HGRCPATH |
|
195 | $ echo "[progress]" >> $HGRCPATH | |
194 | $ echo "assume-tty=1" >> $HGRCPATH |
|
196 | $ echo "assume-tty=1" >> $HGRCPATH | |
195 | $ echo "delay=25" >> $HGRCPATH |
|
197 | $ echo "delay=25" >> $HGRCPATH | |
196 | $ echo "width=60" >> $HGRCPATH |
|
198 | $ echo "width=60" >> $HGRCPATH | |
197 |
|
199 | |||
198 | $ MOCKTIME=11 hg -y loop 8 |
|
200 | $ MOCKTIME=11 hg -y loop 8 | |
199 | \r (no-eol) (esc) |
|
201 | \r (no-eol) (esc) | |
200 | loop [=========> ] 2/8 1m07s\r (no-eol) (esc) |
|
202 | loop [=========> ] 2/8 1m07s\r (no-eol) (esc) | |
201 | loop [===============> ] 3/8 56s\r (no-eol) (esc) |
|
203 | loop [===============> ] 3/8 56s\r (no-eol) (esc) | |
202 | loop [=====================> ] 4/8 45s\r (no-eol) (esc) |
|
204 | loop [=====================> ] 4/8 45s\r (no-eol) (esc) | |
203 | loop [==========================> ] 5/8 34s\r (no-eol) (esc) |
|
205 | loop [==========================> ] 5/8 34s\r (no-eol) (esc) | |
204 | loop [================================> ] 6/8 23s\r (no-eol) (esc) |
|
206 | loop [================================> ] 6/8 23s\r (no-eol) (esc) | |
205 | loop [=====================================> ] 7/8 12s\r (no-eol) (esc) |
|
207 | loop [=====================================> ] 7/8 12s\r (no-eol) (esc) | |
206 | \r (no-eol) (esc) |
|
208 | \r (no-eol) (esc) | |
207 |
|
209 | |||
208 | $ MOCKTIME=10000 hg -y loop 4 |
|
210 | $ MOCKTIME=10000 hg -y loop 4 | |
209 | \r (no-eol) (esc) |
|
211 | \r (no-eol) (esc) | |
210 | loop [ ] 0/4\r (no-eol) (esc) |
|
212 | loop [ ] 0/4\r (no-eol) (esc) | |
211 | loop [=========> ] 1/4 8h21m\r (no-eol) (esc) |
|
213 | loop [=========> ] 1/4 8h21m\r (no-eol) (esc) | |
212 | loop [====================> ] 2/4 5h34m\r (no-eol) (esc) |
|
214 | loop [====================> ] 2/4 5h34m\r (no-eol) (esc) | |
213 | loop [==============================> ] 3/4 2h47m\r (no-eol) (esc) |
|
215 | loop [==============================> ] 3/4 2h47m\r (no-eol) (esc) | |
214 | \r (no-eol) (esc) |
|
216 | \r (no-eol) (esc) | |
215 |
|
217 | |||
216 | $ MOCKTIME=1000000 hg -y loop 4 |
|
218 | $ MOCKTIME=1000000 hg -y loop 4 | |
217 | \r (no-eol) (esc) |
|
219 | \r (no-eol) (esc) | |
218 | loop [ ] 0/4\r (no-eol) (esc) |
|
220 | loop [ ] 0/4\r (no-eol) (esc) | |
219 | loop [=========> ] 1/4 5w00d\r (no-eol) (esc) |
|
221 | loop [=========> ] 1/4 5w00d\r (no-eol) (esc) | |
220 | loop [====================> ] 2/4 3w03d\r (no-eol) (esc) |
|
222 | loop [====================> ] 2/4 3w03d\r (no-eol) (esc) | |
221 | loop [=============================> ] 3/4 11d14h\r (no-eol) (esc) |
|
223 | loop [=============================> ] 3/4 11d14h\r (no-eol) (esc) | |
222 | \r (no-eol) (esc) |
|
224 | \r (no-eol) (esc) | |
223 |
|
225 | |||
224 |
|
226 | |||
225 | $ MOCKTIME=14000000 hg -y loop 4 |
|
227 | $ MOCKTIME=14000000 hg -y loop 4 | |
226 | \r (no-eol) (esc) |
|
228 | \r (no-eol) (esc) | |
227 | loop [ ] 0/4\r (no-eol) (esc) |
|
229 | loop [ ] 0/4\r (no-eol) (esc) | |
228 | loop [=========> ] 1/4 1y18w\r (no-eol) (esc) |
|
230 | loop [=========> ] 1/4 1y18w\r (no-eol) (esc) | |
229 | loop [===================> ] 2/4 46w03d\r (no-eol) (esc) |
|
231 | loop [===================> ] 2/4 46w03d\r (no-eol) (esc) | |
230 | loop [=============================> ] 3/4 23w02d\r (no-eol) (esc) |
|
232 | loop [=============================> ] 3/4 23w02d\r (no-eol) (esc) | |
231 | \r (no-eol) (esc) |
|
233 | \r (no-eol) (esc) | |
232 |
|
234 | |||
233 | Non-linear progress: |
|
235 | Non-linear progress: | |
234 |
|
236 | |||
235 | $ MOCKTIME='20 20 20 20 20 20 20 20 20 20 500 500 500 500 500 20 20 20 20 20' hg -y loop 20 |
|
237 | $ MOCKTIME='20 20 20 20 20 20 20 20 20 20 500 500 500 500 500 20 20 20 20 20' hg -y loop 20 | |
236 | \r (no-eol) (esc) |
|
238 | \r (no-eol) (esc) | |
237 | loop [=> ] 1/20 6m21s\r (no-eol) (esc) |
|
239 | loop [=> ] 1/20 6m21s\r (no-eol) (esc) | |
238 | loop [===> ] 2/20 6m01s\r (no-eol) (esc) |
|
240 | loop [===> ] 2/20 6m01s\r (no-eol) (esc) | |
239 | loop [=====> ] 3/20 5m41s\r (no-eol) (esc) |
|
241 | loop [=====> ] 3/20 5m41s\r (no-eol) (esc) | |
240 | loop [=======> ] 4/20 5m21s\r (no-eol) (esc) |
|
242 | loop [=======> ] 4/20 5m21s\r (no-eol) (esc) | |
241 | loop [=========> ] 5/20 5m01s\r (no-eol) (esc) |
|
243 | loop [=========> ] 5/20 5m01s\r (no-eol) (esc) | |
242 | loop [===========> ] 6/20 4m41s\r (no-eol) (esc) |
|
244 | loop [===========> ] 6/20 4m41s\r (no-eol) (esc) | |
243 | loop [=============> ] 7/20 4m21s\r (no-eol) (esc) |
|
245 | loop [=============> ] 7/20 4m21s\r (no-eol) (esc) | |
244 | loop [===============> ] 8/20 4m01s\r (no-eol) (esc) |
|
246 | loop [===============> ] 8/20 4m01s\r (no-eol) (esc) | |
245 | loop [================> ] 9/20 25m40s\r (no-eol) (esc) |
|
247 | loop [================> ] 9/20 25m40s\r (no-eol) (esc) | |
246 | loop [===================> ] 10/20 1h06m\r (no-eol) (esc) |
|
248 | loop [===================> ] 10/20 1h06m\r (no-eol) (esc) | |
247 | loop [=====================> ] 11/20 1h13m\r (no-eol) (esc) |
|
249 | loop [=====================> ] 11/20 1h13m\r (no-eol) (esc) | |
248 | loop [=======================> ] 12/20 1h07m\r (no-eol) (esc) |
|
250 | loop [=======================> ] 12/20 1h07m\r (no-eol) (esc) | |
249 | loop [========================> ] 13/20 58m19s\r (no-eol) (esc) |
|
251 | loop [========================> ] 13/20 58m19s\r (no-eol) (esc) | |
250 | loop [===========================> ] 14/20 7m09s\r (no-eol) (esc) |
|
252 | loop [===========================> ] 14/20 7m09s\r (no-eol) (esc) | |
251 | loop [=============================> ] 15/20 3m38s\r (no-eol) (esc) |
|
253 | loop [=============================> ] 15/20 3m38s\r (no-eol) (esc) | |
252 | loop [===============================> ] 16/20 2m15s\r (no-eol) (esc) |
|
254 | loop [===============================> ] 16/20 2m15s\r (no-eol) (esc) | |
253 | loop [=================================> ] 17/20 1m27s\r (no-eol) (esc) |
|
255 | loop [=================================> ] 17/20 1m27s\r (no-eol) (esc) | |
254 | loop [====================================> ] 18/20 52s\r (no-eol) (esc) |
|
256 | loop [====================================> ] 18/20 52s\r (no-eol) (esc) | |
255 | loop [======================================> ] 19/20 25s\r (no-eol) (esc) |
|
257 | loop [======================================> ] 19/20 25s\r (no-eol) (esc) | |
256 | \r (no-eol) (esc) |
|
258 | \r (no-eol) (esc) | |
257 |
|
259 | |||
258 | Time estimates should not fail when there's no end point: |
|
260 | Time estimates should not fail when there's no end point: | |
259 | $ MOCKTIME=11 hg -y loop -- -4 |
|
261 | $ MOCKTIME=11 hg -y loop -- -4 | |
260 | \r (no-eol) (esc) |
|
262 | \r (no-eol) (esc) | |
261 | loop [ <=> ] 2\r (no-eol) (esc) |
|
263 | loop [ <=> ] 2\r (no-eol) (esc) | |
262 | loop [ <=> ] 3\r (no-eol) (esc) |
|
264 | loop [ <=> ] 3\r (no-eol) (esc) | |
263 | \r (no-eol) (esc) |
|
265 | \r (no-eol) (esc) | |
264 |
|
266 | |||
265 | #endif |
|
267 | #endif | |
266 |
|
268 | |||
267 | test line trimming by '[progress] width', when progress topic contains |
|
269 | test line trimming by '[progress] width', when progress topic contains | |
268 | multi-byte characters, of which length of byte sequence and columns in |
|
270 | multi-byte characters, of which length of byte sequence and columns in | |
269 | display are different from each other. |
|
271 | display are different from each other. | |
270 |
|
272 | |||
271 | $ cp $HGRCPATH.orig $HGRCPATH |
|
273 | $ cp $HGRCPATH.orig $HGRCPATH | |
272 | $ cat >> $HGRCPATH <<EOF |
|
274 | $ cat >> $HGRCPATH <<EOF | |
273 | > [extensions] |
|
275 | > [extensions] | |
274 | > progress= |
|
276 | > progress= | |
275 | > loop=`pwd`/loop.py |
|
277 | > loop=`pwd`/loop.py | |
276 | > [progress] |
|
278 | > [progress] | |
277 | > assume-tty = 1 |
|
279 | > assume-tty = 1 | |
278 | > delay = 0 |
|
280 | > delay = 0 | |
279 | > refresh = 0 |
|
281 | > refresh = 0 | |
280 | > EOF |
|
282 | > EOF | |
281 |
|
283 | |||
282 | $ rm -f loop.pyc |
|
284 | $ rm -f loop.pyc | |
283 | $ cat >> loop.py <<EOF |
|
285 | $ cat >> loop.py <<EOF | |
284 | > # use non-ascii characters as topic label of progress |
|
286 | > # use non-ascii characters as topic label of progress | |
285 | > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes |
|
287 | > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes | |
286 | > topiclabel = u'\u3042\u3044\u3046\u3048'.encode('utf-8') |
|
288 | > topiclabel = u'\u3042\u3044\u3046\u3048'.encode('utf-8') | |
287 | > EOF |
|
289 | > EOF | |
288 |
|
290 | |||
289 | $ cat >> $HGRCPATH <<EOF |
|
291 | $ cat >> $HGRCPATH <<EOF | |
290 | > [progress] |
|
292 | > [progress] | |
291 | > format = topic number |
|
293 | > format = topic number | |
292 | > width= 12 |
|
294 | > width= 12 | |
293 | > EOF |
|
295 | > EOF | |
294 |
|
296 | |||
295 | $ hg --encoding utf-8 -y loop --total 3 3 |
|
297 | $ hg --encoding utf-8 -y loop --total 3 3 | |
296 | \r (no-eol) (esc) |
|
298 | \r (no-eol) (esc) | |
297 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 0/3\r (no-eol) (esc) |
|
299 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 0/3\r (no-eol) (esc) | |
298 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 1/3\r (no-eol) (esc) |
|
300 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 1/3\r (no-eol) (esc) | |
299 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 2/3\r (no-eol) (esc) |
|
301 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 2/3\r (no-eol) (esc) | |
300 | \r (no-eol) (esc) |
|
302 | \r (no-eol) (esc) | |
301 |
|
303 | |||
302 | test calculation of bar width, when progress topic contains multi-byte |
|
304 | test calculation of bar width, when progress topic contains multi-byte | |
303 | characters, of which length of byte sequence and columns in display |
|
305 | characters, of which length of byte sequence and columns in display | |
304 | are different from each other. |
|
306 | are different from each other. | |
305 |
|
307 | |||
306 | $ cat >> $HGRCPATH <<EOF |
|
308 | $ cat >> $HGRCPATH <<EOF | |
307 | > [progress] |
|
309 | > [progress] | |
308 | > format = topic bar |
|
310 | > format = topic bar | |
309 | > width= 21 |
|
311 | > width= 21 | |
310 | > # progwidth should be 9 (= 21 - (8+1) - 3) |
|
312 | > # progwidth should be 9 (= 21 - (8+1) - 3) | |
311 | > EOF |
|
313 | > EOF | |
312 |
|
314 | |||
313 | $ hg --encoding utf-8 -y loop --total 3 3 |
|
315 | $ hg --encoding utf-8 -y loop --total 3 3 | |
314 | \r (no-eol) (esc) |
|
316 | \r (no-eol) (esc) | |
315 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 [ ]\r (no-eol) (esc) |
|
317 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 [ ]\r (no-eol) (esc) | |
316 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 [==> ]\r (no-eol) (esc) |
|
318 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 [==> ]\r (no-eol) (esc) | |
317 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 [=====> ]\r (no-eol) (esc) |
|
319 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88 [=====> ]\r (no-eol) (esc) | |
318 | \r (no-eol) (esc) |
|
320 | \r (no-eol) (esc) | |
319 |
|
321 | |||
320 | test trimming progress items, when they contain multi-byte characters, |
|
322 | test trimming progress items, when they contain multi-byte characters, | |
321 | of which length of byte sequence and columns in display are different |
|
323 | of which length of byte sequence and columns in display are different | |
322 | from each other. |
|
324 | from each other. | |
323 |
|
325 | |||
324 | $ rm -f loop.pyc |
|
326 | $ rm -f loop.pyc | |
325 | $ rm -Rf __pycache__ |
|
327 | $ rm -Rf __pycache__ | |
326 | $ cat >> loop.py <<EOF |
|
328 | $ cat >> loop.py <<EOF | |
327 | > # use non-ascii characters as loop items of progress |
|
329 | > # use non-ascii characters as loop items of progress | |
328 | > loopitems = [ |
|
330 | > loopitems = [ | |
329 | > u'\u3042\u3044'.encode('utf-8'), # 2 x 2 = 4 columns |
|
331 | > u'\u3042\u3044'.encode('utf-8'), # 2 x 2 = 4 columns | |
330 | > u'\u3042\u3044\u3046'.encode('utf-8'), # 2 x 3 = 6 columns |
|
332 | > u'\u3042\u3044\u3046'.encode('utf-8'), # 2 x 3 = 6 columns | |
331 | > u'\u3042\u3044\u3046\u3048'.encode('utf-8'), # 2 x 4 = 8 columns |
|
333 | > u'\u3042\u3044\u3046\u3048'.encode('utf-8'), # 2 x 4 = 8 columns | |
332 | > ] |
|
334 | > ] | |
333 | > def getloopitem(i): |
|
335 | > def getloopitem(i): | |
334 | > return loopitems[i % len(loopitems)] |
|
336 | > return loopitems[i % len(loopitems)] | |
335 | > EOF |
|
337 | > EOF | |
336 |
|
338 | |||
337 | $ cat >> $HGRCPATH <<EOF |
|
339 | $ cat >> $HGRCPATH <<EOF | |
338 | > [progress] |
|
340 | > [progress] | |
339 | > # trim at tail side |
|
341 | > # trim at tail side | |
340 | > format = item+6 |
|
342 | > format = item+6 | |
341 | > EOF |
|
343 | > EOF | |
342 |
|
344 | |||
343 | $ hg --encoding utf-8 -y loop --total 3 3 |
|
345 | $ hg --encoding utf-8 -y loop --total 3 3 | |
344 | \r (no-eol) (esc) |
|
346 | \r (no-eol) (esc) | |
345 | \xe3\x81\x82\xe3\x81\x84 \r (no-eol) (esc) |
|
347 | \xe3\x81\x82\xe3\x81\x84 \r (no-eol) (esc) | |
346 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\r (no-eol) (esc) |
|
348 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\r (no-eol) (esc) | |
347 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\r (no-eol) (esc) |
|
349 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\r (no-eol) (esc) | |
348 | \r (no-eol) (esc) |
|
350 | \r (no-eol) (esc) | |
349 |
|
351 | |||
350 | $ cat >> $HGRCPATH <<EOF |
|
352 | $ cat >> $HGRCPATH <<EOF | |
351 | > [progress] |
|
353 | > [progress] | |
352 | > # trim at left side |
|
354 | > # trim at left side | |
353 | > format = item-6 |
|
355 | > format = item-6 | |
354 | > EOF |
|
356 | > EOF | |
355 |
|
357 | |||
356 | $ hg --encoding utf-8 -y loop --total 3 3 |
|
358 | $ hg --encoding utf-8 -y loop --total 3 3 | |
357 | \r (no-eol) (esc) |
|
359 | \r (no-eol) (esc) | |
358 | \xe3\x81\x82\xe3\x81\x84 \r (no-eol) (esc) |
|
360 | \xe3\x81\x82\xe3\x81\x84 \r (no-eol) (esc) | |
359 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\r (no-eol) (esc) |
|
361 | \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\r (no-eol) (esc) | |
360 | \xe3\x81\x84\xe3\x81\x86\xe3\x81\x88\r (no-eol) (esc) |
|
362 | \xe3\x81\x84\xe3\x81\x86\xe3\x81\x88\r (no-eol) (esc) | |
361 | \r (no-eol) (esc) |
|
363 | \r (no-eol) (esc) |
General Comments 0
You need to be logged in to leave comments.
Login now