Rev 6519: record_stream wasn't being iterated to completion. in http://bazaar.launchpad.net/~jameinel/bzr/2.5-remote-wt-tests-1046697
John Arbash Meinel
john at arbash-meinel.com
Thu Sep 6 11:19:59 UTC 2012
At http://bazaar.launchpad.net/~jameinel/bzr/2.5-remote-wt-tests-1046697
------------------------------------------------------------
revno: 6519
revision-id: john at arbash-meinel.com-20120906111935-m4p8prgxohkg9ywy
parent: john at arbash-meinel.com-20120906102716-0ctvttu7s9cjohl3
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.5-remote-wt-tests-1046697
timestamp: Thu 2012-09-06 15:19:35 +0400
message:
record_stream wasn't being iterated to completion.
This meant that we didn't always finalize a nested_progress_bar.
Which meant that our test suite thought we were at a depth >1.
Which meant that ProgressRecordingUIFactory was discarding
the update messages.
So wrap the progress bar in a try/finally. That way when the
generator exits, we get a proper cleanup.
Note that record_stream is generally driven by iterating the
stream and stepping it, so it isn't too surprising that
we weren't stepping that one final time to trigger generator
teardown.
-------------- next part --------------
=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py 2011-12-19 13:23:58 +0000
+++ b/bzrlib/smart/repository.py 2012-09-06 11:19:35 +0000
@@ -736,15 +736,18 @@
self.seed_state()
pb = ui.ui_factory.nested_progress_bar()
rc = self._record_counter
- # Make and consume sub generators, one per substream type:
- while self.first_bytes is not None:
- substream = NetworkRecordStream(self.iter_substream_bytes())
- # after substream is fully consumed, self.current_type is set to
- # the next type, and self.first_bytes is set to the matching bytes.
- yield self.current_type, wrap_and_count(pb, rc, substream)
- if rc:
- pb.update('Done', rc.max, rc.max)
- pb.finished()
+ try:
+ # Make and consume sub generators, one per substream type:
+ while self.first_bytes is not None:
+ substream = NetworkRecordStream(self.iter_substream_bytes())
+ # after substream is fully consumed, self.current_type is set
+ # to the next type, and self.first_bytes is set to the matching
+ # bytes.
+ yield self.current_type, wrap_and_count(pb, rc, substream)
+ finally:
+ if rc:
+ pb.update('Done', rc.max, rc.max)
+ pb.finished()
def seed_state(self):
"""Prepare the _ByteStreamDecoder to decode from the pack stream."""
More information about the bazaar-commits
mailing list