##// END OF EJS Templates
progress: stop getting stuck in a nested topic during a long inner step...
Augie Fackler -
r19619:4694ccd5 default
parent child Browse files
Show More
@@ -239,6 +239,13 b' class progbar(object):'
239 # this one are also closed
239 # this one are also closed
240 if topic in self.topics:
240 if topic in self.topics:
241 self.topics = self.topics[:self.topics.index(topic)]
241 self.topics = self.topics[:self.topics.index(topic)]
242 # reset the last topic to the one we just unwound to,
243 # so that higher-level topics will be stickier than
244 # lower-level topics
245 if self.topics:
246 self.lasttopic = self.topics[-1]
247 else:
248 self.lasttopic = None
242 else:
249 else:
243 if topic not in self.topics:
250 if topic not in self.topics:
244 self.starttimes[topic] = now
251 self.starttimes[topic] = now
@@ -1,6 +1,14 b''
1
1
2 $ cat > loop.py <<EOF
2 $ cat > loop.py <<EOF
3 > from mercurial import commands
3 > from mercurial import commands
4 > import time
5 > class incrementingtime(object):
6 > def __init__(self):
7 > self._time = 0.0
8 > def __call__(self):
9 > self._time += 0.25
10 > return self._time
11 > time.time = incrementingtime()
4 >
12 >
5 > def loop(ui, loops, **opts):
13 > def loop(ui, loops, **opts):
6 > loops = int(loops)
14 > loops = int(loops)
@@ -19,9 +27,14 b''
19 > if opts.get('parallel'):
27 > if opts.get('parallel'):
20 > ui.progress('other', i, 'other.%d' % i, 'othernum', total)
28 > ui.progress('other', i, 'other.%d' % i, 'othernum', total)
21 > if nested:
29 > if nested:
22 > for j in range(2):
30 > nested_steps = 2
23 > ui.progress('nested', j, 'nested.%d' % j, 'nestnum', 2)
31 > if i and i % 4 == 0:
24 > ui.progress('nested', None, 'nested.done', 'nestnum', 2)
32 > nested_steps = 5
33 > for j in range(nested_steps):
34 > ui.progress(
35 > 'nested', j, 'nested.%d' % j, 'nestnum', nested_steps)
36 > ui.progress(
37 > 'nested', None, 'nested.done', 'nestnum', nested_steps)
25 > ui.progress('loop', None, 'loop.done', 'loopnum', total)
38 > ui.progress('loop', None, 'loop.done', 'loopnum', total)
26 >
39 >
27 > commands.norepo += " loop"
40 > commands.norepo += " loop"
@@ -69,6 +82,24 b' test nested short-lived topics (which sh'
69 loop [===============================> ] 2/3\r (no-eol) (esc)
82 loop [===============================> ] 2/3\r (no-eol) (esc)
70 \r (no-eol) (esc)
83 \r (no-eol) (esc)
71
84
85 Test nested long-lived topic which has the same name as a short-lived
86 peer. We shouldn't get stuck showing the short-lived inner steps, and
87 should go back to skipping the inner steps when the slow nested step
88 finishes.
89
90 $ hg -y loop 7 --nested
91 \r (no-eol) (esc)
92 loop [ ] 0/7\r (no-eol) (esc)
93 loop [=====> ] 1/7\r (no-eol) (esc)
94 loop [============> ] 2/7\r (no-eol) (esc)
95 loop [===================> ] 3/7\r (no-eol) (esc)
96 loop [==========================> ] 4/7\r (no-eol) (esc)
97 nested [==========================> ] 3/5\r (no-eol) (esc)
98 nested [===================================> ] 4/5\r (no-eol) (esc)
99 loop [=================================> ] 5/7\r (no-eol) (esc)
100 loop [========================================> ] 6/7\r (no-eol) (esc)
101 \r (no-eol) (esc)
102
72
103
73 $ hg --config progress.changedelay=0 -y loop 3 --nested
104 $ hg --config progress.changedelay=0 -y loop 3 --nested
74 \r (no-eol) (esc)
105 \r (no-eol) (esc)
General Comments 0
You need to be logged in to leave comments. Login now