[MERGE] Move protocol version querying logic into the medium

Andrew Bennetts andrew at canonical.com
Fri Feb 29 09:07:45 GMT 2008


Robert Collins wrote:
> On Fri, 2008-02-29 at 01:42 +1100, Andrew Bennetts wrote:
> > --- bzrlib/bzrdir.py    2008-02-24 16:42:13 +0000
> > +++ bzrlib/bzrdir.py    2008-02-28 14:21:20 +0000
> > @@ -2393,18 +2393,15 @@
> >      def probe_transport(klass, transport):
> >          """Return a RemoteBzrDirFormat object if it looks
> > possible."""
> >          try:
> > -            client = transport.get_smart_client()
> > +            medium = transport.get_smart_client()
> 
> please use transport.get_smart_medium() here :).

I'd like to, but it's not as trivial as it looks, so rather than follow that
rabbit hole I thought I'd post the improvement I already had.  I'll have another
shot at switching it to get_smart_medium cleanly, though.

> > +            # Decline to open it if the server doesn't support our
> > required
> > +            # version (2) so that the VFS-based transport will do it.
> > +            server_version = medium.protocol_version()
> >              if server_version != 2:
> >                  raise errors.NotBranchError(path=transport.base)
> >              return klass()
> 
> Comment: I still don't like probing for versions at all; it should
> really just be deferred to the first request/response pair's result on a
> given stream.

Yeah.  It's potentially awkward if the first request has a body, but it'd be
nice to do.

> bb:approve

Thanks!  I'll play around again with switching that to get_smart_medium before I
merge.

-Andrew.




More information about the bazaar mailing list