[MERGE] Rename SmartTransport and friends to RemoteTransport, RemoteTCPTransport, etc.

Andrew Bennetts andrew at canonical.com
Fri Apr 13 06:20:38 BST 2007


The NEWS entry in this bundle says it all, I hope:

    * Renamed SmartTransport (and subclasses like SmartTCPTransport) to
      RemoteTransport (and subclasses to RemoteTCPTransport, etc).  This is more
      consistent with its new home in bzrlib/transport/remote.py, and because
      it's not really a "smart" transport, just one that does file operations
      via remote procedure calls.  (Andrew Bennetts)
 
This doesn't break backwards compatibility any more than the split of classes
into a new bzrlib.smart package already did.

-Andrew.

-------------- next part --------------
# Bazaar revision bundle v0.9
#
# message:
#   Rename Smart.*Transport classes to RemoteTransport, RemoteTCPTransport, etc.
# committer: Andrew Bennetts <andrew.bennetts at canonical.com>
# date: Fri 2007-04-13 15:15:36.796999931 +1000

=== modified file NEWS
--- NEWS
+++ NEWS
@@ -40,6 +40,12 @@
     * Move most SmartServer code into a new package, bzrlib/smart.
       bzrlib/transport/remote.py contains just the Transport classes that used
       to be in bzrlib/transport/smart.py.  (Andrew Bennetts)
+
+    * Renamed SmartTransport (and subclasses like SmartTCPTransport) to
+      RemoteTransport (and subclasses to RemoteTCPTransport, etc).  This is more
+      consistent with its new home in bzrlib/transport/remote.py, and because
+      it's not really a "smart" transport, just one that does file operations
+      via remote procedure calls.  (Andrew Bennetts)
  
   BUGFIXES:
 

=== modified file bzrlib/tests/blackbox/test_serve.py
--- bzrlib/tests/blackbox/test_serve.py
+++ bzrlib/tests/blackbox/test_serve.py
@@ -71,7 +71,7 @@
         # server instance, the transport needs a URL.
         client_medium = medium.SmartSimplePipesClientMedium(
             process.stdout, process.stdin)
-        transport = remote.SmartTransport(
+        transport = remote.RemoteTransport(
             'bzr://localhost/', medium=client_medium)
         return process, transport
 

=== modified file bzrlib/tests/test_smart_transport.py
--- bzrlib/tests/test_smart_transport.py
+++ bzrlib/tests/test_smart_transport.py
@@ -534,7 +534,7 @@
 
     def test_probe_transport(self):
         t = self.get_transport()
-        self.assertIsInstance(t, remote.SmartTransport)
+        self.assertIsInstance(t, remote.RemoteTransport)
 
     def test_get_medium_from_transport(self):
         """Remote transport has a medium always, which it can return."""
@@ -793,7 +793,7 @@
         smart_server = server.SmartTCPServer(backing_transport=FlakyTransport())
         smart_server.start_background_thread()
         try:
-            transport = remote.SmartTCPTransport(smart_server.get_url())
+            transport = remote.RemoteTCPTransport(smart_server.get_url())
             try:
                 transport.get('something')
             except errors.TransportError, e:
@@ -824,7 +824,7 @@
             self.backing_transport = get_transport("readonly+" + self.backing_transport.abspath('.'))
         self.server = server.SmartTCPServer(self.backing_transport)
         self.server.start_background_thread()
-        self.transport = remote.SmartTCPTransport(self.server.get_url())
+        self.transport = remote.RemoteTCPTransport(self.server.get_url())
         self.addCleanup(self.tearDownServer)
 
     def tearDownServer(self):
@@ -842,7 +842,7 @@
         """It should be safe to teardown the server with no requests."""
         self.setUpServer()
         server = self.server
-        transport = remote.SmartTCPTransport(self.server.get_url())
+        transport = remote.RemoteTCPTransport(self.server.get_url())
         self.tearDownServer()
         self.assertRaises(errors.ConnectionError, transport.has, '.')
 
@@ -854,7 +854,7 @@
         self.tearDownServer()
         # if the listening socket has closed, we should get a BADFD error
         # when connecting, rather than a hang.
-        transport = remote.SmartTCPTransport(server.get_url())
+        transport = remote.RemoteTCPTransport(server.get_url())
         self.assertRaises(errors.ConnectionError, transport.has, '.')
 
 
@@ -1111,7 +1111,7 @@
 
     def test_registration(self):
         t = get_transport('bzr+ssh://example.com/path')
-        self.assertIsInstance(t, remote.SmartSSHTransport)
+        self.assertIsInstance(t, remote.RemoteSSHTransport)
         self.assertEqual('example.com', t._host)
 
 
@@ -1122,7 +1122,7 @@
         input = StringIO("ok\n3\nbardone\n")
         output = StringIO()
         client_medium = medium.SmartSimplePipesClientMedium(input, output)
-        transport = remote.SmartTransport(
+        transport = remote.RemoteTransport(
             'bzr://localhost/', medium=client_medium)
 
         # We want to make sure the client is used when the first remote
@@ -1142,7 +1142,7 @@
     def test__translate_error_readonly(self):
         """Sending a ReadOnlyError to _translate_error raises TransportNotPossible."""
         client_medium = medium.SmartClientMedium()
-        transport = remote.SmartTransport(
+        transport = remote.RemoteTransport(
             'bzr://localhost/', medium=client_medium)
         self.assertRaises(errors.TransportNotPossible,
             transport._translate_error, ("ReadOnlyError", ))
@@ -1544,7 +1544,7 @@
         http_transport = self.get_readonly_transport()
         medium = http_transport.get_smart_medium()
         #remote_transport = RemoteTransport('fake_url', medium)
-        remote_transport = remote.SmartTransport('/', medium=medium)
+        remote_transport = remote.RemoteTransport('/', medium=medium)
         self.assertEqual(
             [(0, "c")], list(remote_transport.readv("data-file", [(0,1)])))
 

=== modified file bzrlib/transport/__init__.py
--- bzrlib/transport/__init__.py
+++ bzrlib/transport/__init__.py
@@ -1252,10 +1252,10 @@
                         'FakeVFATTransportDecorator')
 register_lazy_transport('bzr://',
                         'bzrlib.transport.remote',
-                        'SmartTCPTransport')
+                        'RemoteTCPTransport')
 register_lazy_transport('bzr+http://',
                         'bzrlib.transport.remote',
-                        'SmartHTTPTransport')
+                        'RemoteHTTPTransport')
 register_lazy_transport('bzr+ssh://',
                         'bzrlib.transport.remote',
-                        'SmartSSHTransport')
+                        'RemoteSSHTransport')

=== modified file bzrlib/transport/remote.py
--- bzrlib/transport/remote.py
+++ bzrlib/transport/remote.py
@@ -42,7 +42,7 @@
         self.st_mode = mode
 
 
-class SmartTransport(transport.Transport):
+class RemoteTransport(transport.Transport):
     """Connection to a smart server.
 
     The connection holds references to pipes that can be used to send requests
@@ -56,13 +56,13 @@
 
     The connection can be made over a tcp socket, or (in future) an ssh pipe
     or a series of http requests.  There are concrete subclasses for each
-    type: SmartTCPTransport, etc.
+    type: RemoteTCPTransport, etc.
     """
 
-    # IMPORTANT FOR IMPLEMENTORS: SmartTransport MUST NOT be given encoding
+    # IMPORTANT FOR IMPLEMENTORS: RemoteTransport MUST NOT be given encoding
     # responsibilities: Put those on SmartClient or similar. This is vital for
     # the ability to support multiple versions of the smart protocol over time:
-    # SmartTransport is an adapter from the Transport object model to the 
+    # RemoteTransport is an adapter from the Transport object model to the 
     # SmartClient model, not an encoder.
 
     def __init__(self, url, clone_from=None, medium=None):
@@ -76,7 +76,7 @@
         ### initialisation order things would blow up. 
         if not url.endswith('/'):
             url += '/'
-        super(SmartTransport, self).__init__(url)
+        super(RemoteTransport, self).__init__(url)
         self._scheme, self._username, self._password, self._host, self._port, self._path = \
                 transport.split_url(url)
         if clone_from is None:
@@ -98,14 +98,14 @@
         return self._unparse_url(self._remote_path(relpath))
     
     def clone(self, relative_url):
-        """Make a new SmartTransport related to me, sharing the same connection.
+        """Make a new RemoteTransport related to me, sharing the same connection.
 
         This essentially opens a handle on a different remote directory.
         """
         if relative_url is None:
-            return SmartTransport(self.base, self)
+            return RemoteTransport(self.base, self)
         else:
-            return SmartTransport(self.abspath(relative_url), self)
+            return RemoteTransport(self.abspath(relative_url), self)
 
     def is_readonly(self):
         """Smart server transport can do read/write file operations."""
@@ -399,7 +399,7 @@
 
 
 
-class SmartTCPTransport(SmartTransport):
+class RemoteTCPTransport(RemoteTransport):
     """Connection to smart server over plain tcp.
     
     This is essentially just a factory to get 'RemoteTransport(url,
@@ -418,10 +418,10 @@
                 raise errors.InvalidURL(
                     path=url, extra="invalid port %s" % _port)
         medium = SmartTCPClientMedium(_host, _port)
-        super(SmartTCPTransport, self).__init__(url, medium=medium)
-
-
-class SmartSSHTransport(SmartTransport):
+        super(RemoteTCPTransport, self).__init__(url, medium=medium)
+
+
+class RemoteSSHTransport(RemoteTransport):
     """Connection to smart server over SSH.
 
     This is essentially just a factory to get 'RemoteTransport(url,
@@ -438,13 +438,13 @@
             raise errors.InvalidURL(path=url, extra="invalid port %s" % 
                 _port)
         medium = SmartSSHClientMedium(_host, _port, _username, _password)
-        super(SmartSSHTransport, self).__init__(url, medium=medium)
-
-
-class SmartHTTPTransport(SmartTransport):
+        super(RemoteSSHTransport, self).__init__(url, medium=medium)
+
+
+class RemoteHTTPTransport(RemoteTransport):
     """Just a way to connect between a bzr+http:// url and http://.
     
-    This connection operates slightly differently than the SmartSSHTransport.
+    This connection operates slightly differently than the RemoteSSHTransport.
     It uses a plain http:// transport underneath, which defines what remote
     .bzr/smart URL we are connected to. From there, all paths that are sent are
     sent as relative paths, this way, the remote side can properly
@@ -461,7 +461,7 @@
         else:
             self._http_transport = http_transport
         http_medium = self._http_transport.get_smart_medium()
-        super(SmartHTTPTransport, self).__init__(url, medium=http_medium)
+        super(RemoteHTTPTransport, self).__init__(url, medium=http_medium)
 
     def _remote_path(self, relpath):
         """After connecting HTTP Transport only deals in relative URLs."""
@@ -479,10 +479,10 @@
         return self._unparse_url(self._combine_paths(self._path, relpath))
 
     def clone(self, relative_url):
-        """Make a new SmartHTTPTransport related to me.
+        """Make a new RemoteHTTPTransport related to me.
 
         This is re-implemented rather than using the default
-        SmartTransport.clone() because we must be careful about the underlying
+        RemoteTransport.clone() because we must be careful about the underlying
         http transport.
         """
         if relative_url:
@@ -492,7 +492,7 @@
         # By cloning the underlying http_transport, we are able to share the
         # connection.
         new_transport = self._http_transport.clone(relative_url)
-        return SmartHTTPTransport(abs_url, http_transport=new_transport)
+        return RemoteHTTPTransport(abs_url, http_transport=new_transport)
 
 
 def get_test_permutations():
@@ -500,4 +500,4 @@
     from bzrlib.smart import server
     ### We may need a little more test framework support to construct an
     ### appropriate RemoteTransport in the future.
-    return [(SmartTCPTransport, server.SmartTCPServer_for_testing)]
+    return [(RemoteTCPTransport, server.SmartTCPServer_for_testing)]

=== modified directory  // last-changed:andrew.bennetts at canonical.com-200704130
... 51536-omtgid0zygdfbvra
# revision id: andrew.bennetts at canonical.com-20070413051536-omtgid0zygdfbvra
# sha1: 27e8f7931f0d660f2522ea5eab6768decc908300
# inventory sha1: 1f7cf86ed36cfd34d07f76966d6949fc5eb2aa5b
# parent ids:
#   pqm at pqm.ubuntu.com-20070412150356-jeie6iap22sae8xf
# base id: pqm at pqm.ubuntu.com-20070412150356-jeie6iap22sae8xf
# properties:
#   branch-nick: rename-SmartTransport



More information about the bazaar mailing list