why does has_same_location check the class?

Andrew Bennetts andrew at canonical.com
Wed Aug 29 03:41:28 BST 2007


Martin Pool wrote:
> At the moment in bzr.dev the has_same_location implementation checks
> that the two objects are of the same class and that they have the same
> location.  The first part of this has caused some failures in the
> pack/inventory work because it the vfs-based repository used by a
> RemoteRepository to be seen as having a different location.  And
> anyhow, it's a bit inconsistent with the name.
> 
> Is there any reason to keep this check?

Not that I know of.  I think it's just a leftover from when I originally wrote
the method as __eq__.  I'm +1 for just comparing location and not class.

> Also, at the moment Repository, Branch, WorkingTree are all subclasses
> of object.  There is some common behaviour between them that could
> usefully be split into a base class, maybe called "Component" (of a
> BzrDir).  Any comments, objections, or better names?

This sounds like an excellent idea.

No obviously good name springs to mind.  BzrDirMeta1's docstring calls these
things "aspects", which isn't any better than "Component".  "Component" seems ok
to me, although I think I'd like it to have a prefix.  "BzrComponent" perhaps?

-Andrew.




More information about the bazaar mailing list