[PATCH 1 of 2] ui: make terminal size always come from util (issue5395)
Simon Farnsworth
simonfar at fb.com
Fri Oct 7 12:07:53 UTC 2016
# HG changeset patch
# User Simon Farnsworth <simonfar at fb.com>
# Date 1475835159 -7200
# Fri Oct 07 12:12:39 2016 +0200
# Node ID 5831f8daf49f2eabe5b7e6ba0f3da1fc61b5ed09
# Parent 1779dde4c9ef97cb242f8d501655f236f66e5439
ui: make terminal size always come from util (issue5395)
Everyone uses the ui version of termwidth(), not the util version. Make the
ui version just an alias for the util version
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -814,11 +814,6 @@
def termwidth(self):
'''how wide is the terminal in columns?
'''
- if 'COLUMNS' in os.environ:
- try:
- return int(os.environ['COLUMNS'])
- except ValueError:
- pass
return util.termwidth()
def formatted(self):
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -120,13 +120,20 @@
statfiles = getattr(osutil, 'statfiles', platform.statfiles)
statisexec = platform.statisexec
statislink = platform.statislink
-termwidth = platform.termwidth
testpid = platform.testpid
umask = platform.umask
unlink = platform.unlink
unlinkpath = platform.unlinkpath
username = platform.username
+def termwidth():
+ if 'COLUMNS' in os.environ:
+ try:
+ return int(os.environ['COLUMNS'])
+ except ValueError:
+ pass
+ return platform.termwidth()
+
# Python compatibility
_notset = object()
More information about the Mercurial-devel
mailing list