##// END OF EJS Templates
progress: obtain stderr from ui...
Yuya Nishihara -
r30324:cb1ea3cc default
parent child Browse files
Show More
@@ -7,7 +7,6 b''
7 7
8 8 from __future__ import absolute_import
9 9
10 import sys
11 10 import threading
12 11 import time
13 12
@@ -19,7 +18,7 b' def spacejoin(*args):'
19 18
20 19 def shouldprint(ui):
21 20 return not (ui.quiet or ui.plain('progress')) and (
22 ui._isatty(sys.stderr) or ui.configbool('progress', 'assume-tty'))
21 ui._isatty(ui.ferr) or ui.configbool('progress', 'assume-tty'))
23 22
24 23 def fmtremaining(seconds):
25 24 """format a number of remaining seconds in human readable way
@@ -158,14 +157,14 b' class progbar(object):'
158 157 out = spacejoin(head, prog, tail)
159 158 else:
160 159 out = spacejoin(head, tail)
161 sys.stderr.write('\r' + encoding.trim(out, termwidth))
160 self.ui.ferr.write('\r' + encoding.trim(out, termwidth))
162 161 self.lasttopic = topic
163 sys.stderr.flush()
162 self.ui.ferr.flush()
164 163
165 164 def clear(self):
166 165 if not self.printed or not self.lastprint or not shouldprint(self.ui):
167 166 return
168 sys.stderr.write('\r%s\r' % (' ' * self.width()))
167 self.ui.ferr.write('\r%s\r' % (' ' * self.width()))
169 168 if self.printed:
170 169 # force immediate re-paint of progress bar
171 170 self.lastprint = 0
@@ -176,8 +175,8 b' class progbar(object):'
176 175 if self.ui.configbool('progress', 'clear-complete', default=True):
177 176 self.clear()
178 177 else:
179 sys.stderr.write('\n')
180 sys.stderr.flush()
178 self.ui.ferr.write('\n')
179 self.ui.ferr.flush()
181 180
182 181 def width(self):
183 182 tw = self.ui.termwidth()
General Comments 0
You need to be logged in to leave comments. Login now