Rev 5598: (vila) Accept 0 to mean no limit for BZR_COLUMNS (Neil in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Jan 12 01:34:47 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5598 [merge]
revision-id: pqm at pqm.ubuntu.com-20110112013446-le2folid2nfkgncn
parent: pqm at pqm.ubuntu.com-20110112004317-81kxafod33p5lqal
parent: v.ladeuil+lp at free.fr-20110112005805-tzclc2wogqef8zty
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-01-12 01:34:46 +0000
message:
(vila) Accept 0 to mean no limit for BZR_COLUMNS (Neil
Martinsen-Burrell)
modified:
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/tests/blackbox/test_help.py test_help.py-20060216004358-4ee8a2a338f75a62
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py 2011-01-11 20:20:13 +0000
+++ b/bzrlib/osutils.py 2011-01-12 00:58:05 +0000
@@ -1461,10 +1461,16 @@
# a similar effect.
# If BZR_COLUMNS is set, take it, user is always right
+ # Except if they specified 0 in which case, impose no limit here
try:
- return int(os.environ['BZR_COLUMNS'])
+ width = int(os.environ['BZR_COLUMNS'])
except (KeyError, ValueError):
- pass
+ width = None
+ if width is not None:
+ if width > 0:
+ return width
+ else:
+ return None
isatty = getattr(sys.stdout, 'isatty', None)
if isatty is None or not isatty():
=== modified file 'bzrlib/tests/blackbox/test_help.py'
--- a/bzrlib/tests/blackbox/test_help.py 2010-08-29 14:32:45 +0000
+++ b/bzrlib/tests/blackbox/test_help.py 2011-01-12 00:58:05 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2009, 2010 Canonical Ltd
+# Copyright (C) 2006, 2007, 2009, 2010, 2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -104,6 +104,10 @@
self.assertEquals(dash_help, qmark_long)
self.assertEquals(dash_help, qmark_cmds)
+ def test_help_width_zero(self):
+ self.overrideEnv('BZR_COLUMNS', '0')
+ self.run_bzr('help commands')
+
def test_hidden(self):
help_commands = self.run_bzr('help commands')[0]
help_hidden = self.run_bzr('help hidden-commands')[0]
=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py 2010-12-16 15:29:10 +0000
+++ b/bzrlib/tests/test_osutils.py 2011-01-12 00:58:05 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2010 Canonical Ltd
+# Copyright (C) 2005-2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -1988,6 +1988,10 @@
self.overrideEnv('BZR_COLUMNS', '12')
self.assertEqual(12, osutils.terminal_width())
+ def test_BZR_COLUMNS_0_no_limit(self):
+ self.overrideEnv('BZR_COLUMNS', '0')
+ self.assertEqual(None, osutils.terminal_width())
+
def test_falls_back_to_COLUMNS(self):
self.overrideEnv('BZR_COLUMNS', None)
self.assertNotEqual('42', os.environ['COLUMNS'])
=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt 2011-01-12 00:08:41 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt 2011-01-12 00:58:05 +0000
@@ -74,6 +74,9 @@
been recommended since 2007. The file itself will be removed in the next
release. (John Arbash Meinel)
+* The BZR_COLUMNS environment variable can be set to 0 to indicate no
+ limitation on the width of the terminal. (Neil Martinsen-Burrell, #675652)
+
Documentation
*************
More information about the bazaar-commits
mailing list