Skip to content
Snippets Groups Projects
Commit 5c379b1f authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

scmutil: make termwidth() obtain stdio from ui

I'm getting rid of direct sys.stderr|out|in references so Py3 porting will
be slightly easier.
parent 4b1af1c8
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,7 @@
else:
return [os.path.expanduser('~/.hgrc')]
def termwidth():
def termwidth(ui):
try:
import array
import termios
......@@ -45,7 +45,7 @@
try:
import array
import termios
for dev in (sys.stderr, sys.stdout, sys.stdin):
for dev in (ui.ferr, ui.fout, ui.fin):
try:
try:
fd = dev.fileno()
......
......@@ -53,5 +53,5 @@
path.append(os.path.join(userprofile, '.hgrc'))
return path
def termwidth():
def termwidth(ui):
return win32.termwidth()
......@@ -822,7 +822,7 @@
return int(encoding.environ['COLUMNS'])
except ValueError:
pass
return scmutil.termwidth()
return scmutil.termwidth(self)
def formatted(self):
'''should formatted output be used?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment