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