[MERGE] nested-progress-bar api

Robert Collins robertc at robertcollins.net
Tue Mar 7 20:31:44 GMT 2006


On Tue, 2006-03-07 at 09:59 -0500, Aaron Bentley wrote:


> > +    def return_pb(self, bar):
> > +        """Return bar after its been used."""
> > +        if bar != self._stack[-1]:
> 
> Shouldn't this be "if bar is not"?  You want to get the same thing back,
> not an equivalent thing, right?

yes, will fix.

> >  class TextUIFactory(UIFactory):
> > -
> > -    def __init__(self):
> > -        super(TextUIFactory, self).__init__()
> > -        self._progress_bar_stack = None
> 
> Huh?  Why'd we have this in the first place?

It was in the core patch, which was my first couple of commits on the
branch, but I realised it needed to be in the base class later. So it
shows up in the second patch as a move.


> >          if self.bzrdir.root_transport.is_readonly():
> >              raise errors.UpgradeReadonly
> >          self.transport = self.bzrdir.root_transport
> > -        self.convert()
> > +        self.pb = ui.ui_factory.nested_progress_bar()
> > +        try:
> > +            self.convert()
> > +        finally:
> > +            self.pb.finished()
> 
> Personally, I'd pass the pb in, because it's not part of the object's
> permanent state.  If you're doing this, you should probably do self.pb =
> None after the finished() call.

Well there are no entry points to the object that do not set self.pb, so
it will always be a newly acquired one.

> +1, possibly with a tweak or two.

Thanks,
Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060308/29af25ac/attachment.pgp 


More information about the bazaar mailing list