Rev 4454: (mbp) resurrect BZR_PROGRESS_BAR in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Jun 17 11:04:42 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4454
revision-id: pqm at pqm.ubuntu.com-20090617100437-gavn9zkum4dj5yjz
parent: pqm at pqm.ubuntu.com-20090617090735-796uiadbn7zulvlu
parent: mbp at sourcefrog.net-20090617070441-34nn8rmx0ijt5j04
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-06-17 11:04:37 +0100
message:
(mbp) resurrect BZR_PROGRESS_BAR
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/tests/blackbox/test_diff.py test_diff.py-20060110203741-aa99ac93e633d971
bzrlib/tests/test_ui.py test_ui.py-20051130162854-458e667a7414af09
bzrlib/ui/text.py text.py-20051130153916-2e438cffc8afc478
------------------------------------------------------------
revno: 4449.2.6
revision-id: mbp at sourcefrog.net-20090617070441-34nn8rmx0ijt5j04
parent: mbp at sourcefrog.net-20090617065903-2wia9lfa60o1yy6k
parent: pqm at pqm.ubuntu.com-20090617055321-5t6v2ugwdrjvnrgv
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: 339385-set-progress-bar
timestamp: Wed 2009-06-17 17:04:41 +1000
message:
merge news
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzr bzr.py-20050313053754-5485f144c7006fa6
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/revisiontree.py revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/tree_implementations/test_list_files.py test_list_files.py-20070216005501-cjh6fzprbe9lbs2t-1
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
------------------------------------------------------------
revno: 4449.2.5
revision-id: mbp at sourcefrog.net-20090617065903-2wia9lfa60o1yy6k
parent: mbp at sourcefrog.net-20090617051648-ansc6ce1s8w0yxey
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: 339385-set-progress-bar
timestamp: Wed 2009-06-17 16:59:03 +1000
message:
Removing exception class bumped API version
modified:
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
------------------------------------------------------------
revno: 4449.2.4
revision-id: mbp at sourcefrog.net-20090617051648-ansc6ce1s8w0yxey
parent: mbp at sourcefrog.net-20090617051141-lcylxd64rdipbnpz
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: 339385-set-progress-bar
timestamp: Wed 2009-06-17 15:16:48 +1000
message:
Add tests for BZR_PROGRESS_BAR
modified:
bzrlib/tests/test_ui.py test_ui.py-20051130162854-458e667a7414af09
------------------------------------------------------------
revno: 4449.2.3
revision-id: mbp at sourcefrog.net-20090617051141-lcylxd64rdipbnpz
parent: mbp at sourcefrog.net-20090617050528-3cohates2o6hmupm
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: 339385-set-progress-bar
timestamp: Wed 2009-06-17 15:11:41 +1000
message:
test_diff doesn't need so much special code to set env vars
modified:
bzrlib/tests/blackbox/test_diff.py test_diff.py-20060110203741-aa99ac93e633d971
------------------------------------------------------------
revno: 4449.2.2
revision-id: mbp at sourcefrog.net-20090617050528-3cohates2o6hmupm
parent: mbp at sourcefrog.net-20090617050318-1f2ju463ltz52mtj
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: 339385-set-progress-bar
timestamp: Wed 2009-06-17 15:05:28 +1000
message:
Remove over-specific error InvalidProgressBarType.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
------------------------------------------------------------
revno: 4449.2.1
revision-id: mbp at sourcefrog.net-20090617050318-1f2ju463ltz52mtj
parent: pqm at pqm.ubuntu.com-20090616193232-rorncr6v3z633n9u
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: 339385-set-progress-bar
timestamp: Wed 2009-06-17 15:03:18 +1000
message:
TextUIFactory now respects BZR_PROGRESS_BAR again
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/ui/text.py text.py-20051130153916-2e438cffc8afc478
=== modified file 'NEWS'
--- a/NEWS 2009-06-17 08:08:36 +0000
+++ b/NEWS 2009-06-17 10:04:37 +0000
@@ -31,6 +31,10 @@
* ``Branch.set_append_revisions_only`` now works with branches on a smart
server. (Andrew Bennetts, #365865)
+* Progress bars are now suppressed again when the environment variable
+ ``BZR_PROGRESS_BAR`` is set to ``none``.
+ (Martin Pool, #339385)
+
Internals
*********
@@ -61,6 +65,16 @@
* Minor clarifications to the help for End-Of-Line conversions.
(Ian Clatworthy)
+API Changes
+***********
+
+* Removed overspecific error class ``InvalidProgressBarType``.
+ (Martin Pool)
+
+* The method ``ProgressView._show_transport_activity`` is now
+ ``show_transport_activity`` because it's part of the contract between
+ this class and the UI. (Martin Pool)
+
bzr 1.16rc1 "It's yesterday in California" 2009-06-11
#####################################################
=== modified file 'bzrlib/__init__.py'
--- a/bzrlib/__init__.py 2009-06-12 08:38:52 +0000
+++ b/bzrlib/__init__.py 2009-06-17 06:59:03 +0000
@@ -53,7 +53,7 @@
version_info = (1, 17, 0, 'dev', 0)
# API compatibility version: bzrlib is currently API compatible with 1.15.
-api_minimum_version = (1, 15, 0)
+api_minimum_version = (1, 17, 0)
def _format_version_tuple(version_info):
"""Turn a version number 2, 3 or 5-tuple into a short string.
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2009-06-16 12:22:20 +0000
+++ b/bzrlib/errors.py 2009-06-17 05:05:28 +0000
@@ -2172,15 +2172,6 @@
_fmt = "Cannot perform local-only commits on unbound branches."
-class InvalidProgressBarType(BzrError):
-
- _fmt = ("Environment variable BZR_PROGRESS_BAR='%(bar_type)s"
- " is not a supported type Select one of: %(valid_types)s")
-
- def __init__(self, bar_type, valid_types):
- BzrError.__init__(self, bar_type=bar_type, valid_types=valid_types)
-
-
class UnsupportedOperation(BzrError):
_fmt = ("The method %(mname)s is not supported on"
=== modified file 'bzrlib/tests/blackbox/test_diff.py'
--- a/bzrlib/tests/blackbox/test_diff.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/blackbox/test_diff.py 2009-06-17 05:11:41 +0000
@@ -360,18 +360,11 @@
# subprocess.py that we had to workaround).
# However, if 'diff' may not be available
self.make_example_branch()
- orig_progress = os.environ.get('BZR_PROGRESS_BAR')
- try:
- os.environ['BZR_PROGRESS_BAR'] = 'none'
- out, err = self.run_bzr_subprocess('diff -r 1 --diff-options -ub',
- universal_newlines=True,
- retcode=None)
- finally:
- if orig_progress is None:
- del os.environ['BZR_PROGRESS_BAR']
- else:
- os.environ['BZR_PROGRESS_BAR'] = orig_progress
-
+ # this will be automatically restored by the base bzr test class
+ os.environ['BZR_PROGRESS_BAR'] = 'none'
+ out, err = self.run_bzr_subprocess('diff -r 1 --diff-options -ub',
+ universal_newlines=True,
+ retcode=None)
if 'Diff is not installed on this machine' in err:
raise TestSkipped("No external 'diff' is available")
self.assertEqual('', err)
=== modified file 'bzrlib/tests/test_ui.py'
--- a/bzrlib/tests/test_ui.py 2009-06-10 03:56:49 +0000
+++ b/bzrlib/tests/test_ui.py 2009-06-17 05:16:48 +0000
@@ -39,6 +39,7 @@
SilentUIFactory,
)
from bzrlib.ui.text import (
+ NullProgressView,
TextProgressView,
TextUIFactory,
)
@@ -103,6 +104,25 @@
finally:
pb.finished()
+ def test_progress_construction(self):
+ """TextUIFactory constructs the right progress view.
+ """
+ os.environ['BZR_PROGRESS_BAR'] = 'none'
+ self.assertIsInstance(TextUIFactory()._progress_view,
+ NullProgressView)
+
+ os.environ['BZR_PROGRESS_BAR'] = 'text'
+ self.assertIsInstance(TextUIFactory()._progress_view,
+ TextProgressView)
+
+ os.environ['BZR_PROGRESS_BAR'] = 'text'
+ self.assertIsInstance(TextUIFactory()._progress_view,
+ TextProgressView)
+
+ del os.environ['BZR_PROGRESS_BAR']
+ self.assertIsInstance(TextUIFactory()._progress_view,
+ TextProgressView)
+
def test_progress_note(self):
stderr = StringIO()
stdout = StringIO()
=== modified file 'bzrlib/ui/text.py'
--- a/bzrlib/ui/text.py 2009-04-10 19:37:20 +0000
+++ b/bzrlib/ui/text.py 2009-06-17 05:03:18 +0000
@@ -19,6 +19,7 @@
"""Text UI, write output to the console.
"""
+import os
import sys
import time
import warnings
@@ -56,8 +57,8 @@
symbol_versioning.warn(symbol_versioning.deprecated_in((1, 11, 0))
% "bar_type parameter")
# paints progress, network activity, etc
- self._progress_view = TextProgressView(self.stderr)
-
+ self._progress_view = self._make_progress_view()
+
def clear_term(self):
"""Prepare the terminal for output.
@@ -69,6 +70,12 @@
# to clear it. We might need to separately check for the case of
self._progress_view.clear()
+ def _make_progress_view(self):
+ if os.environ.get('BZR_PROGRESS_BAR') in ('text', None, ''):
+ return TextProgressView(self.stderr)
+ else:
+ return NullProgressView()
+
def note(self, msg):
"""Write an already-formatted message, clearing the progress bar if necessary."""
self.clear_term()
@@ -80,7 +87,7 @@
This may update a progress bar, spinner, or similar display.
By default it does nothing.
"""
- self._progress_view._show_transport_activity(transport,
+ self._progress_view.show_transport_activity(transport,
direction, byte_count)
def _progress_updated(self, task):
@@ -98,6 +105,19 @@
self._progress_view.clear()
+class NullProgressView(object):
+ """Soak up and ignore progress information."""
+
+ def clear(self):
+ pass
+
+ def show_progress(self, task):
+ pass
+
+ def show_transport_activity(self, transport, direction, byte_count):
+ pass
+
+
class TextProgressView(object):
"""Display of progress bar and other information on a tty.
@@ -216,7 +236,7 @@
self._last_repaint = now
self._repaint()
- def _show_transport_activity(self, transport, direction, byte_count):
+ def show_transport_activity(self, transport, direction, byte_count):
"""Called by transports via the ui_factory, as they do IO.
This may update a progress bar, spinner, or similar display.
More information about the bazaar-commits
mailing list