[MERGE] Compatibility with bzr 0.11 smart server

Andrew Bennetts andrew at canonical.com
Thu May 3 18:45:23 BST 2007


Robert already applied this diff directly to bzr 0.16rc2, but I don't think it's
been merged to bzr.dev yet.

This fixes current versions of bzr to operate smoothly with old old versions of
the smart server, like 0.11, which give a slightly different error message than
e.g. 0.15.

-Andrew.

-------------- next part --------------
# Bazaar revision bundle v0.9
#
# message:
#   Fix trivial incompatibility with bzr 0.11 servers, which give a slightly different error to bzr 0.15 servers.
# committer: Andrew Bennetts <andrew.bennetts at canonical.com>
# date: Mon 2007-04-30 16:42:24.848999977 +1000

=== modified file bzrlib/tests/test_remote.py
--- bzrlib/tests/test_remote.py
+++ bzrlib/tests/test_remote.py
@@ -422,6 +422,20 @@
             [('call', 'Transport.is_readonly', ())],
             client._calls)
 
+    def test_error_from_old_0_11_server(self):
+        """Same as test_error_from_old_server, but with the slightly different
+        error message from bzr 0.11 servers.
+        """
+        client = FakeClient([(
+            ('error', "Generic bzr smart protocol error: "
+                      "bad request u'Transport.is_readonly'"), '')])
+        transport = RemoteTransport('bzr://example.com/', medium=False,
+                                    _client=client)
+        self.assertEqual(False, transport.is_readonly())
+        self.assertEqual(
+            [('call', 'Transport.is_readonly', ())],
+            client._calls)
+
 
 class TestRemoteRepository(tests.TestCase):
     """Base for testing RemoteRepository protocol usage.

=== modified file bzrlib/transport/remote.py
--- bzrlib/transport/remote.py
+++ bzrlib/transport/remote.py
@@ -133,8 +133,10 @@
             return True
         elif resp == ('no', ):
             return False
-        elif resp == ('error', "Generic bzr smart protocol error: "
-                               "bad request 'Transport.is_readonly'"):
+        elif (resp == ('error', "Generic bzr smart protocol error: "
+                                "bad request 'Transport.is_readonly'") or
+              resp == ('error', "Generic bzr smart protocol error: "
+                                "bad request u'Transport.is_readonly'")):
             # XXX: nasty hack: servers before 0.16 don't have a
             # 'Transport.is_readonly' verb, so we do what clients before 0.16
             # did: assume False.

=== modified directory  // last-changed:andrew.bennetts at canonical.com-200704300
... 64224-hagj8m0855p1sxn7
# revision id: andrew.bennetts at canonical.com-20070430064224-hagj8m0855p1sxn7
# sha1: 899fcdd513ec75388081bf8511d82a2b87684f00
# inventory sha1: ac7c87da377a28c45b4b67be57b44978916fa990
# parent ids:
#   pqm at pqm.ubuntu.com-20070430054416-kl8x12cim7g45lap
# base id: pqm at pqm.ubuntu.com-20070430054416-kl8x12cim7g45lap
# properties:
#   branch-nick: hpss-0.11-compat



More information about the bazaar mailing list