comparison hgext/progress.py @ 10464:149ad0a3ec91 stable

progress: make progress.refresh=0 always display the progress line This has no effect in real world where progress.refresh in unlikely to be set to zero, but is very useful in tests where all progress output is to be traced. It failed on platforms with coarse time.time() granularity, like Windows+py25.
author Patrick Mezard <pmezard@gmail.com>
date Sun, 14 Feb 2010 15:42:47 +0100
parents 5ddde896a19d
children 132eb7128ad5
comparison
equal deleted inserted replaced
10463:5ddde896a19d 10464:149ad0a3ec91
154 self.resetstate() 154 self.resetstate()
155 else: 155 else:
156 if topic not in self.topics: 156 if topic not in self.topics:
157 self.topics.append(topic) 157 self.topics.append(topic)
158 now = time.time() 158 now = time.time()
159 if now - self.lastprint > self.refresh and topic == self.topics[-1]: 159 if (now - self.lastprint >= self.refresh
160 and topic == self.topics[-1]):
160 self.lastprint = now 161 self.lastprint = now
161 self.show(topic, pos, item, unit, total) 162 self.show(topic, pos, item, unit, total)
162 return orig(topic, pos, item=item, unit=unit, total=total) 163 return orig(topic, pos, item=item, unit=unit, total=total)
163 164
164 def write(self, orig, *args): 165 def write(self, orig, *args):