Merge lp:~mbp/bzr/611127-2.2-progress into lp:bzr/2.2

Proposed by Martin Pool
Status: Merged
Approved by: Martin Pool
Approved revision: no longer in the source branch.
Merged at revision: 5070
Proposed branch: lp:~mbp/bzr/611127-2.2-progress
Merge into: lp:bzr/2.2
Diff against target: 75 lines (+25/-5)
3 files modified
NEWS (+5/-4)
bzrlib/tests/test_progress.py (+15/-0)
bzrlib/ui/text.py (+5/-1)
To merge this branch: bzr merge lp:~mbp/bzr/611127-2.2-progress
Reviewer Review Type Date Requested Status
Andrew Bennetts Approve
Review via email: mp+31824@code.launchpad.net

Commit message

fix bug 611127, clearing progress bars

Description of the change

Fix a regression with progress bars not being cleared off properly. This just restores this method pretty much to how it was in 2.1.

I would like to merge this before 2.2.0.

Fixes https://bugs.edge.launchpad.net/bzr/+bug/611127

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

+1

Revision history for this message
Andrew Bennetts (spiv) wrote :

I suppose theoretically if _avail_width is None this could remember the width of the last uncleared message(s), but then terminals that can't report widths probably aren't used here anyway. Anyway, this seems like a clear and simple improvement, so +1.

review: Approve
Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2010-08-02 19:56:52 +0000
+++ NEWS 2010-08-05 08:31:42 +0000
@@ -5,11 +5,11 @@
5.. contents:: List of Releases5.. contents:: List of Releases
6 :depth: 16 :depth: 1
77
8bzr 2.2rc18bzr 2.2.0
9##########9#########
1010
11:Codename: ???11:Codename: ???
12:2.2rc1: NOT RELEASED YET12:2.2.0: NOT RELEASED YET
1313
14Compatibility Breaks14Compatibility Breaks
15********************15********************
@@ -48,7 +48,8 @@
4848
49* Progress bars prefer to truncate the text message rather than the49* Progress bars prefer to truncate the text message rather than the
50 counters. The spinner is shown between the network transfer indicator50 counters. The spinner is shown between the network transfer indicator
51 and the progress message. (Martin Pool)51 and the progress message. Progress bars are correctly cleared off when
52 they finish. (Martin Pool, #611127)
5253
53* Recursive binding for checkouts is now detected by bzr. A clear error54* Recursive binding for checkouts is now detected by bzr. A clear error
54 message is shown to the user. (Parth Malwankar, #405192)55 message is shown to the user. (Parth Malwankar, #405192)
5556
=== modified file 'bzrlib/tests/test_progress.py'
--- bzrlib/tests/test_progress.py 2010-07-09 15:47:01 +0000
+++ bzrlib/tests/test_progress.py 2010-08-05 08:31:42 +0000
@@ -70,6 +70,21 @@
70 task.total_cnt = total70 task.total_cnt = total
71 return task71 return task
7272
73 def test_clear(self):
74 # <https://bugs.launchpad.net/bzr/+bug/611127> clear must actually
75 # send spaces to clear the line
76 out, view = self.make_view()
77 task = self.make_task(None, view, 'reticulating splines', 5, 20)
78 view.show_progress(task)
79 self.assertEqual(
80'\r/ reticulating splines 5/20 \r'
81 , out.getvalue())
82 view.clear()
83 self.assertEqual(
84'\r/ reticulating splines 5/20 \r'
85 + '\r' + 79 * ' ' + '\r',
86 out.getvalue())
87
73 def test_render_progress_no_bar(self):88 def test_render_progress_no_bar(self):
74 """The default view now has a spinner but no bar."""89 """The default view now has a spinner but no bar."""
75 out, view = self.make_view()90 out, view = self.make_view()
7691
=== modified file 'bzrlib/ui/text.py'
--- bzrlib/ui/text.py 2010-07-09 15:47:01 +0000
+++ bzrlib/ui/text.py 2010-08-05 08:31:42 +0000
@@ -304,11 +304,15 @@
304 # we need one extra space for terminals that wrap on last char304 # we need one extra space for terminals that wrap on last char
305 w = osutils.terminal_width() 305 w = osutils.terminal_width()
306 if w is None:306 if w is None:
307 return w307 return None
308 else:308 else:
309 return w - 1309 return w - 1
310310
311 def _show_line(self, s):311 def _show_line(self, s):
312 # sys.stderr.write("progress %r\n" % s)
313 width = self._avail_width()
314 if width is not None:
315 s = '%-*.*s' % (width, width, s)
312 self._term_file.write('\r' + s + '\r')316 self._term_file.write('\r' + s + '\r')
313317
314 def clear(self):318 def clear(self):

Subscribers

People subscribed via source and target branches