comparison hgext/progress.py @ 16753:9cca7b70f8df

progress: use ui._isatty
author Matt Mackall <mpm@selenic.com>
date Sun, 20 May 2012 14:37:20 -0500
parents 38caf405d010
children b4744c3b991e
comparison
equal deleted inserted replaced
16752:359fda6cb01d 16753:9cca7b70f8df
36 """ 36 """
37 37
38 import sys 38 import sys
39 import time 39 import time
40 40
41 from mercurial import util
42 from mercurial.i18n import _ 41 from mercurial.i18n import _
43 testedwith = 'internal' 42 testedwith = 'internal'
44 43
45 def spacejoin(*args): 44 def spacejoin(*args):
46 return ' '.join(s for s in args if s) 45 return ' '.join(s for s in args if s)
47 46
48 def shouldprint(ui): 47 def shouldprint(ui):
49 return util.isatty(sys.stderr) or ui.configbool('progress', 'assume-tty') 48 return ui._isatty(sys.stderr) or ui.configbool('progress', 'assume-tty')
50 49
51 def fmtremaining(seconds): 50 def fmtremaining(seconds):
52 if seconds < 60: 51 if seconds < 60:
53 # i18n: format XX seconds as "XXs" 52 # i18n: format XX seconds as "XXs"
54 return _("%02ds") % (seconds) 53 return _("%02ds") % (seconds)