[merge] split out repository formats

Martin Pool mbp at canonical.com
Wed Feb 7 07:17:05 GMT 2007


On  6 Feb 2007, John Arbash Meinel <john at arbash-meinel.com> wrote:
> Aaron Bentley wrote:
> > Martin Pool wrote:
> >> Now personally I would rather in most cases dispense with the Format
> >> object and class altogether and just hold the actual Repository class or
> >> whatever.
> > 
> > This is what I don't understand: if you feel (as I do) that the
> > RepositoryFormat objects should be part of the Repository objects, why
> > do you want to split them into a separate file?

I'm not moving just the Format objects, but rather both the Repository
and RepositoryFormat subclasses.

> I think he is just trying to shrink the repository.py file. And this is
> just a step in that direction. My hope is that this was a start that
> would end with also moving the Repository classes into their own files.

Yes.

> By the way, moving classes like this is pretty hard on backwards
> compatibility. Or at least you can import it back into the original
> module, but if the goal is to not load unused code, you lose that
> benefit. I suppose you could do it temporarily and then in the next
> release you can remove the local import.

I was going to time it and see if the increased laziness was any faster.
Circular imports may make it a bit hard to keep the name in the same
place...

> As far as Martin's comments, I would rather see them holding classes
> rather than instances. Partially because lazy loading a class is more
> obvious than lazy loading an instance. It can work either way, though.
> 
> (You can implement a callable that returns just about anything, versus
> an instance which already has to *be* that thing).

Ok I will change the interface to register a callable.  I agree it's
more flexible.

-- 
Martin



More information about the bazaar mailing list