comparison mercurial/util.py @ 12689:c52c629ce19e

termwidth: move to ui.ui from util
author Augie Fackler <durin42@gmail.com>
date Sun, 10 Oct 2010 10:06:36 -0500
parents 9b324c5e6273
children 7aef77e74cf3
comparison
equal deleted inserted replaced
12688:8c034a825cfe 12689:c52c629ce19e
1391 for i in iterable: 1391 for i in iterable:
1392 if not i: 1392 if not i:
1393 return False 1393 return False
1394 return True 1394 return True
1395 1395
1396 def termwidth():
1397 if 'COLUMNS' in os.environ:
1398 try:
1399 return int(os.environ['COLUMNS'])
1400 except ValueError:
1401 pass
1402 return termwidth_()
1403
1404 def interpolate(prefix, mapping, s, fn=None): 1396 def interpolate(prefix, mapping, s, fn=None):
1405 """Return the result of interpolating items in the mapping into string s. 1397 """Return the result of interpolating items in the mapping into string s.
1406 1398
1407 prefix is a single character string, or a two character string with 1399 prefix is a single character string, or a two character string with
1408 a backslash as the first character if the prefix needs to be escaped in 1400 a backslash as the first character if the prefix needs to be escaped in