HPSS: Client-side objects

Andrew Bennetts andrew at canonical.com
Wed Apr 18 11:54:49 BST 2007


Robert Collins wrote:
> On Tue, 2007-04-17 at 19:00 +1000, Andrew Bennetts wrote:
> > 
> > 
> > Because calling BzrDir.open_from_transport here causes infinite
> > recursion.
> > 
> > I've added this XXX to explain it:
> > 
> >             # XXX: We can't use BzrDir.open_from_transport here
> > because it
> >             # causes infinite recursion, so just try opening the
> > bzrdir with the
> >             # default format. 
> 
> I don't think this is sufficient - its a bug. I think what is needed is
> a 'open_from_transport' that does not attempt to get a smart client or
> perform any other client-server style access. This further implies that
> the current hack of inserting client-server formats at the front of an
> undifferentiated list is not sufficient.

Fair enough.

I've added a _server_formats flag to BzrDir.open_from_transport and
BzrDirFormat.find_format, it defaults to True, and RemoteBzrDir._ensure_real
passes False.  And there's now a separate list for
register_control_server_format.  Let me know if you can think of a better name
for the _server_formats parameter (maybe it should be public, not underscored?).

This also required me to change RemoteBranch.control_files to be a property, so
that its initialisation can be deferred until its actually used (if ever).
Otherwise a bunch of things in test_remote that previously didn't require there
to be a real branch to test things started needing real branches, because
RemoteBranch.__init__ would call RemoteBranchLockableFiles.__init__ would call
the bzrdir's get_branch_transport, which calls _ensure_real, so merely
constructing a remote branch would realise the VFS branch too.  I think this
change is clearly a good idea anyway; avoiding unnecessary calls to _ensure_real
is a good thing.

I've attached a diff of just these changes, but I think they should be pretty
uncontroversial.

Thanks for the review!

-Andrew.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hpss-client-objects-update.diff
Type: text/x-diff
Size: 5906 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070418/4525eb20/attachment.bin 


More information about the bazaar mailing list