[merge] MVC progress bars, and indication of network traffic

Martin Pool mbp at canonical.com
Tue Dec 16 23:04:13 GMT 2008

This reworks the progress bar / ui infrastructure a bit so that we get
an indication of network activity.

Previously, the progress bars shown by bzr rely on the library code that
is for instance copying revisions updating a progress bar object.  We
have a concept of stacking where one operation like fetching revisions
can be composed of some lower-level tasks.  The good thing about this is
that it gives us a chance to give an overall progress indication or
prediction.  The drawbacks are that if the code in one place doesn't
update the progress bar often enough, it just stays stuck - there is a
case at the moment where it just shows '0/0' for an extended period.

This patch allows for transports to pass information back to the ui
object to report on traffic coming in and out.

At the moment only the sftp transport does this, and only for a couple
of read operations.  You can see it working with e.g. './bzr branch
sftp://bazaar.launchpad.net/~bzr/bzr/trunk'.  I expect we'd only do this
on network transports, including hpss.

I think the result is pretty good, it really gives a sense that
something is happening and may also point out cases where we're either
reading too much data or not filling the pipe.

In adding this I realized it wouldn't fit well with the current
progressbar code, which has different classes for different types of
display.  It seems to me what we want is really a model/view
distinction, where most of the code updates a general model of a task
happening, and then that's drawn appropriately for the UI.

There's a similar issue that I think we want to just choose the right UI
object for the situation we're in, and then that should determine how
the progress indicator is drawn.  So the new make_ui_for_terminal
function does that.  I think this will help with GUIs too.  I have not
checked this against bzr-gtk; I probably should.

This removes MissingProgressBarFinish which I think adds little compared
to just an AssertionError.

There's more we could do here but this is getting long, so I'll ask for
review now.  One of the main things to follow on would be to deprecate
or just remove the older ProgressBar classes, and also look at
simplifying the code which currently passes pb objects around.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20081216-progress.diff
Type: text/x-diff
Size: 46801 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20081217/de495011/attachment-0001.bin 

More information about the bazaar mailing list