Rev 4890: (mbp) turn off progress bar; just show a spinner in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Dec 14 06:05:34 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4890 [merge]
revision-id: pqm at pqm.ubuntu.com-20091214060530-uk93cdya34wzxb0s
parent: pqm at pqm.ubuntu.com-20091210235739-zwgaqsbb2mk57gyv
parent: mbp at sourcefrog.net-20091209075806-a3nnd8dcnpdfrppn
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-12-14 06:05:30 +0000
message:
(mbp) turn off progress bar; just show a spinner
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/test_progress.py test_progress.py-20060308160359-978c397bc79b7fda
bzrlib/ui/text.py text.py-20051130153916-2e438cffc8afc478
=== modified file 'NEWS'
--- a/NEWS 2009-12-10 21:49:20 +0000
+++ b/NEWS 2009-12-14 06:05:30 +0000
@@ -112,6 +112,12 @@
'file://localhost/' as well as 'file:///' URLs on POSIX. (Michael
Hudson)
+* The progress bar now shows only a spinner and per-operation counts,
+ not an overall progress bar. The previous bar was often not correlated
+ with real overall operation progress, either because the operations take
+ nonlinear time, or because at the start of the operation Bazaar couldn't
+ estimate how much work there was to do. (Martin Pool)
+
Documentation
*************
=== modified file 'bzrlib/tests/test_progress.py'
--- a/bzrlib/tests/test_progress.py 2009-06-19 07:28:41 +0000
+++ b/bzrlib/tests/test_progress.py 2009-12-09 07:58:06 +0000
@@ -70,9 +70,20 @@
task.total_cnt = total
return task
+ def test_render_progress_no_bar(self):
+ """The default view now has a spinner but no bar."""
+ out, view = self.make_view()
+ # view.enable_bar = False
+ task = self.make_task(None, view, 'reticulating splines', 5, 20)
+ view.show_progress(task)
+ self.assertEqual(
+'\r/ reticulating splines 5/20 \r'
+ , out.getvalue())
+
def test_render_progress_easy(self):
"""Just one task and one quarter done"""
out, view = self.make_view()
+ view.enable_bar = True
task = self.make_task(None, view, 'reticulating splines', 5, 20)
view.show_progress(task)
self.assertEqual(
@@ -85,6 +96,7 @@
task = self.make_task(None, view, 'reticulating splines', 0, 2)
task2 = self.make_task(task, view, 'stage2', 1, 2)
view.show_progress(task2)
+ view.enable_bar = True
# so we're in the first half of the main task, and half way through
# that
self.assertEqual(
@@ -100,6 +112,7 @@
def test_render_progress_sub_nested(self):
"""Intermediate tasks don't mess up calculation."""
out, view = self.make_view()
+ view.enable_bar = True
task_a = ProgressTask(None, progress_view=view)
task_a.update('a', 0, 2)
task_b = ProgressTask(task_a, progress_view=view)
=== modified file 'bzrlib/ui/text.py'
--- a/bzrlib/ui/text.py 2009-12-10 16:54:28 +0000
+++ b/bzrlib/ui/text.py 2009-12-14 06:05:30 +0000
@@ -261,6 +261,9 @@
self._total_byte_count = 0
self._bytes_since_update = 0
self._fraction = 0
+ # force the progress bar to be off, as at the moment it doesn't
+ # correspond reliably to overall command progress
+ self.enable_bar = False
def _show_line(self, s):
# sys.stderr.write("progress %r\n" % s)
@@ -276,7 +279,8 @@
def _render_bar(self):
# return a string for the progress bar itself
- if (self._last_task is None) or self._last_task.show_bar:
+ if self.enable_bar and (
+ (self._last_task is None) or self._last_task.show_bar):
# If there's no task object, we show space for the bar anyhow.
# That's because most invocations of bzr will end showing progress
# at some point, though perhaps only after doing some initial IO.
More information about the bazaar-commits
mailing list