[REVIEW] Progress bars for tree transforms

Aaron Bentley aaron.bentley at utoronto.ca
Tue Feb 21 21:19:37 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel wrote:
> As far as ui_factory, I think the current code is a little bogus. I
> would prefer bzrlib to maintain as little state as possible, to help
> with thread safety.

Right.  Here, you pass merge a progress bar at the very top level, so
you can vary the type or whatever.

 I'm okay with having factories, which can have more
> objects registered to them. But just thinking about how one would write
> a front-end which changes the ui_factory behavior seems a little clumsy,
> but at least it is better than accessing ProgressBar directly.

Yeah, it's just that it's safe to import names from modules everywhere
else, so I'd want to continue that here.

So I'd rather have

Class UIFactory:
   def __init__(self):
     self.__state = SilentThingy()
   def progress_bar(self):
     return self.__state.progress_bar()
   def setFactory(self, factoryobj):
     self.__state = factoryobj

ui_factory = UIFactory()

>>So the fact that I'm supplying a default parameter that is a stateless
>>do-nothing object is a concern?
> 
> 
> Originally, I misread your code as:
> 
> def merge(...
>           pb=ui_factory.progress_bar()):
> 
> which would be a concern, but you are right, using DummyProgress()
> shouldn't be a problem. And I understand how it makes your code easier.

If indeed it does :-)

>>All I want is repositories and I will be happy putting up endless
>>feature branches.
>>
>>But for right now, I'd rather send patches.  That patch should apply
>>cleanly to bzr.dev, or anything closely related.

> I understand. The problem is that if I were to apply this patch, and you
> merge it into one of your branches, it will conflict when I try to merge
> you. (it happened before with test_find_missing.py).

Okay.  Yeah, I only meant applying it for testing purposes, not
committing or anything.

> Anyway, +1 from me. 

Thanks.

> Feel free to merge it into bzr.dev yourself. You may
> want to wait until Robert & Martin wake up, so they have a chance to
> veto it in case I missed something.

Well, I've put it in now, but we can always revert it if something's
seriously wrong.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD4DBQFD+4Pp0F+nu1YWqI0RAoKTAJja6fYiish6fShCTKyCXHHa6AgIAJ42Goke
CwUtGwr33A8N8/mPatpx3Q==
=CLhu
-----END PGP SIGNATURE-----




More information about the bazaar mailing list