Rev 2576: (Vincent Ladeuil) Merge fix for #110448 in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jul 3 09:08:42 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2576
revision-id: pqm at pqm.ubuntu.com-20070703080840-vjh1sot1a5nwix4h
parent: pqm at pqm.ubuntu.com-20070703073546-9dv8bocak8u3ou6m
parent: ian.clatworthy at internode.on.net-20070703073711-grb8q45os61y904x
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2007-07-03 09:08:40 +0100
message:
  (Vincent Ladeuil) Merge fix for #110448 
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_dirstate.py  test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
  bzrlib/tests/test_sftp_transport.py testsftp.py-20051027032739-247570325fec7e7e
  bzrlib/tests/test_transport.py testtransport.py-20050718175618-e5cdb99f4555ddce
    ------------------------------------------------------------
    revno: 2574.1.2
    merged: ian.clatworthy at internode.on.net-20070703073711-grb8q45os61y904x
    parent: ian.clatworthy at internode.on.net-20070703070332-45j7qw8z03fnulav
    parent: v.ladeuil+lp at free.fr-20070609153407-c5jx52cfk47jydq5
    committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
    branch nick: ianc-integration
    timestamp: Tue 2007-07-03 17:37:11 +1000
    message:
      (Vincent Ladeuil) Merge fix for #110448 
    ------------------------------------------------------------
    revno: 2520.3.1
    merged: v.ladeuil+lp at free.fr-20070609153407-c5jx52cfk47jydq5
    parent: pqm at pqm.ubuntu.com-20070608134340-flu6dlpzyo7izrrs
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: 110448
    timestamp: Sat 2007-06-09 17:34:07 +0200
    message:
      Fix 110448 by adding a relpath parameter to get_transport.
      
      * bzrlib/tests/__init__.py:
      (TestCaseWithMemoryTransport.get_transport,
      get_readonly_transport): Add a relpath parameter.
      
      * bzrlib/tests/test_transport.py:
      (TestTransportImplementation.get_transport): Add a relpath
      parameter.
      
      * bzrlib/tests/test_sftp_transport.py:
      (TestCaseWithSFTPServer.get_tranport): Deleted.
      
      * bzrlib/tests/test_dirstate.py:
      (TestCaseWithDirState.create_basic_dirstate): Use the new shiny
      get_transport !
=== modified file 'NEWS'
--- a/NEWS	2007-07-03 00:40:04 +0000
+++ b/NEWS	2007-07-03 07:37:11 +0000
@@ -126,6 +126,10 @@
     * The base TestCase now isolates tests from -D parameters by clearing
       ``debug.debug_flags`` and restores it afterwards. (Robert Collins)
 
+    * Add a relpath parameter to get_transport methods in test framework to
+      avoid useless cloning.
+      (Vincent Ladeuil, #110448)
+
   BUGFIXES:
 
     * Work around python-2.4.1 inhability to correctly parse the

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-07-03 05:24:58 +0000
+++ b/bzrlib/tests/__init__.py	2007-07-03 07:37:11 +0000
@@ -1638,19 +1638,27 @@
         self.transport_readonly_server = None
         self.__vfs_server = None
 
-    def get_transport(self):
-        """Return a writeable transport for the test scratch space"""
-        t = get_transport(self.get_url())
+    def get_transport(self, relpath=None):
+        """Return a writeable transport.
+
+        This transport is for the test scratch space relative to
+        "self._test_root""
+        
+        :param relpath: a path relative to the base url.
+        """
+        t = get_transport(self.get_url(relpath))
         self.assertFalse(t.is_readonly())
         return t
 
-    def get_readonly_transport(self):
+    def get_readonly_transport(self, relpath=None):
         """Return a readonly transport for the test scratch space
         
         This can be used to test that operations which should only need
         readonly access in fact do not try to write.
+
+        :param relpath: a path relative to the base url.
         """
-        t = get_transport(self.get_readonly_url())
+        t = get_transport(self.get_readonly_url(relpath))
         self.assertTrue(t.is_readonly())
         return t
 
@@ -1687,11 +1695,7 @@
         These should only be downwards relative, not upwards.
         """
         base = self.get_readonly_server().get_url()
-        if relpath is not None:
-            if not base.endswith('/'):
-                base = base + '/'
-            base = base + relpath
-        return base
+        return self._adjust_url(base, relpath)
 
     def get_vfs_only_server(self):
         """Get the vfs only read/write server instance.

=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py	2007-06-07 22:31:44 +0000
+++ b/bzrlib/tests/test_dirstate.py	2007-06-09 15:34:07 +0000
@@ -200,7 +200,7 @@
         tree.commit('initial', rev_id='rev-1')
         revision_id = 'rev-1'
         # a_packed_stat = dirstate.pack_stat(os.stat('tree/a'))
-        t = self.get_transport().clone('tree')
+        t = self.get_transport('tree')
         a_text = t.get_bytes('a')
         a_sha = osutils.sha_string(a_text)
         a_len = len(a_text)

=== modified file 'bzrlib/tests/test_sftp_transport.py'
--- a/bzrlib/tests/test_sftp_transport.py	2007-03-28 08:49:06 +0000
+++ b/bzrlib/tests/test_sftp_transport.py	2007-06-09 15:34:07 +0000
@@ -59,10 +59,6 @@
             raise TestSkipped('you must have paramiko to run this test')
         set_test_transport_to_sftp(self)
 
-    def get_transport(self, path=None):
-        """Return a transport relative to self._test_root."""
-        return bzrlib.transport.get_transport(self.get_url(path))
-
 
 class SFTPLockTests (TestCaseWithSFTPServer):
 

=== modified file 'bzrlib/tests/test_transport.py'
--- a/bzrlib/tests/test_transport.py	2007-05-04 10:41:31 +0000
+++ b/bzrlib/tests/test_transport.py	2007-06-09 15:34:07 +0000
@@ -540,15 +540,19 @@
         self._server.setUp()
         self.addCleanup(self._server.tearDown)
 
-    def get_transport(self):
-        """Return a connected transport to the local directory."""
+    def get_transport(self, relpath=None):
+        """Return a connected transport to the local directory.
+
+        :param relpath: a path relative to the base url.
+        """
         base_url = self._server.get_url()
+        url = self._adjust_url(base_url, relpath)
         # try getting the transport via the regular interface:
-        t = get_transport(base_url)
+        t = get_transport(url)
         if not isinstance(t, self.transport_class):
             # we did not get the correct transport class type. Override the
             # regular connection behaviour by direct construction.
-            t = self.transport_class(base_url)
+            t = self.transport_class(url)
         return t
 
 




More information about the bazaar-commits mailing list