[MERGE][0.16] Allow new smart client to work with old (<= 0.15) smart servers.
Andrew Bennetts
andrew at canonical.com
Tue Apr 24 12:49:27 BST 2007
Andrew Bennetts wrote:
> After a suggestion from Robert, this bundle will allow the new hpss clients to
[...]
I totally hit the attach button, and mutt just wants to spite me. Either that,
or I was distracted by the imminent dinner...
Here's the belated bundle.
-Andrew.
-------------- next part --------------
# Bazaar revision bundle v0.9
#
# message:
# Try a version 1 hello probe to determine if we can use RemoteBzrDir on a particular transport, allowing smooth interoperation with older servers.
# committer: Andrew Bennetts <andrew.bennetts at canonical.com>
# date: Tue 2007-04-24 20:25:46.566999912 +1000
=== modified file bzrlib/bzrdir.py
--- bzrlib/bzrdir.py
+++ bzrlib/bzrdir.py
@@ -57,6 +57,7 @@
sha_string,
)
from bzrlib.smart.client import _SmartClient
+from bzrlib.smart import protocol
from bzrlib.store.revision.text import TextRevisionStore
from bzrlib.store.text import TextStore
from bzrlib.store.versioned import WeaveStore
@@ -2232,12 +2233,20 @@
def probe_transport(klass, transport):
"""Return a RemoteBzrDirFormat object if it looks possible."""
try:
- transport.get_smart_client()
+ client = transport.get_smart_client()
except (NotImplementedError, AttributeError,
errors.TransportNotPossible):
# no smart server, so not a branch for this format type.
raise errors.NotBranchError(path=transport.base)
else:
+ # Send a 'hello' request in protocol version one, and fail if the
+ # server doesn't support our required version (2).
+ request = client.get_request()
+ smart_protocol = protocol.SmartClientRequestProtocolOne(request)
+ smart_protocol.call('hello')
+ server_version = smart_protocol.read_response_tuple(expect_body=False)
+ if server_version != '2':
+ raise errors.NotBranchError(path=transport.base)
return klass()
def initialize_on_transport(self, transport):
=== modified file bzrlib/remote.py
--- bzrlib/remote.py
+++ bzrlib/remote.py
@@ -53,7 +53,6 @@
self._medium = None
return
- self._ensure_real()
path = self._path_for_remote_call(self._client)
response = self._client.call('BzrDir.open', path)
if response not in [('yes',), ('no',)]:
=== modified directory // last-changed:andrew.bennetts at canonical.com-200704241
... 02546-am5s92urrlfk9zjb
# revision id: andrew.bennetts at canonical.com-20070424102546-am5s92urrlfk9zjb
# sha1: 8ab7cddcafc10ecf135866e2a109acde95a2e014
# inventory sha1: 57525a6324a9cf2bcf078bfccfaa9b7971cd1946
# parent ids:
# andrew.bennetts at canonical.com-20070424090150-9buzrpi8lt6qv0tg
# base id: andrew.bennetts at canonical.com-20070424090150-9buzrpi8lt6qv0tg
# properties:
# bugs:
# branch-nick: hpss-vfs-fallback
More information about the bazaar
mailing list