Rev 4303: Fixup tests broken by cleaning up the layering. in http://people.ubuntu.com/~robertc/baz2.0/pending/push.roundtrips

Robert Collins robertc at robertcollins.net
Mon Apr 27 04:27:53 BST 2009


At http://people.ubuntu.com/~robertc/baz2.0/pending/push.roundtrips

------------------------------------------------------------
revno: 4303
revision-id: robertc at robertcollins.net-20090427032746-vqmcsfbsbvbm04sk
parent: robertc at robertcollins.net-20090424050851-sdfonaqerfs386t0
committer: Robert Collins <robertc at robertcollins.net>
branch nick: push.roundtrips
timestamp: Mon 2009-04-27 13:27:46 +1000
message:
  Fixup tests broken by cleaning up the layering.
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2009-04-24 05:08:51 +0000
+++ b/bzrlib/bzrdir.py	2009-04-27 03:27:46 +0000
@@ -3068,6 +3068,29 @@
             # hand off the request to the smart server
             client_medium = transport.get_smart_medium()
         except errors.NoSmartMedium:
+            do_vfs = True
+        else:
+            # Decline to open it if the server doesn't support our required
+            # version (3) so that the VFS-based transport will do it.
+            if client_medium.should_probe():
+                try:
+                    server_version = client_medium.protocol_version()
+                    if server_version != '2':
+                        do_vfs = True
+                    else:
+                        do_vfs = False
+                except errors.SmartProtocolError:
+                    # Apparently there's no usable smart server there, even though
+                    # the medium supports the smart protocol.
+                    do_vfs = True
+            else:
+                do_vfs = False
+        if not do_vfs:
+            client = _SmartClient(client_medium)
+            path = client.remote_path_from_transport(transport)
+            if client_medium._is_remote_before((1, 15)):
+                do_vfs = True
+        if do_vfs:
             # TODO: lookup the local format from a server hint.
             local_dir_format = BzrDirMetaFormat1()
             self._supply_sub_formats_to(local_dir_format)
@@ -3075,16 +3098,6 @@
                 use_existing_dir=use_existing_dir, create_prefix=create_prefix,
                 force_new_repo=force_new_repo, stacked_on=stacked_on,
                 stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
-                make_working_trees=make_working_trees, shared_repo=shared_repo)
-        client = _SmartClient(client_medium)
-        path = client.remote_path_from_transport(transport)
-        if client_medium._is_remote_before((1, 15)):
-            local_dir_format = BzrDirMetaFormat1()
-            self._supply_sub_formats_to(local_dir_format)
-            return local_dir_format.initialize_on_transport_ex(transport,
-                use_existing_dir=use_existing_dir, create_prefix=create_prefix,
-                force_new_repo=force_new_repo, stacked_on=stacked_on,
-                stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
                 make_working_trees=make_working_trees, shared_repo=shared_repo,
                 vfs_only=True)
         args = []

=== modified file 'bzrlib/tests/branch_implementations/test_create_clone.py'
--- a/bzrlib/tests/branch_implementations/test_create_clone.py	2009-04-20 04:19:45 +0000
+++ b/bzrlib/tests/branch_implementations/test_create_clone.py	2009-04-27 03:27:46 +0000
@@ -30,7 +30,7 @@
         tree.commit('a commit')
         source = tree.branch
         target_transport = self.get_transport('subdir').clone('target')
-        self.assertRaises(errors.BzrCommandError,
+        self.assertRaises(errors.NoSuchFile,
             tree.branch.create_clone_on_transport, target_transport)
         self.assertFalse(self.get_transport('.').has('subdir'))
 
@@ -51,7 +51,7 @@
         source = tree.branch
         target_transport = self.get_transport('target')
         target_transport.create_prefix()
-        self.assertRaises(errors.BzrCommandError,
+        self.assertRaises(errors.FileExists,
             tree.branch.create_clone_on_transport, target_transport)
         self.assertFalse(target_transport.has(".bzr"))
 

=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py	2009-04-04 02:50:01 +0000
+++ b/bzrlib/tests/test_smart_transport.py	2009-04-27 03:27:46 +0000
@@ -1069,7 +1069,7 @@
         self._captureVar('BZR_NO_SMART_VFS', None)
         err = self.assertRaises(
             errors.NoSuchFile, self.transport.get, 'not%20a%20file')
-        self.assertEqual('not%20a%20file', err.path)
+        self.assertSubset([err.path], ['not%20a%20file', './not%20a%20file'])
 
     def test_simple_clone_conn(self):
         """Test that cloning reuses the same connection."""

=== modified file 'bzrlib/transport/http/__init__.py'
--- a/bzrlib/transport/http/__init__.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/transport/http/__init__.py	2009-04-27 03:27:46 +0000
@@ -171,7 +171,6 @@
             self._medium = SmartClientHTTPMedium(self)
         return self._medium
 
-
     def _degrade_range_hint(self, relpath, ranges, exc_info):
         if self._range_hint == 'multi':
             self._range_hint = 'single'

=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py	2009-04-11 06:32:41 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py	2009-04-27 03:27:46 +0000
@@ -917,6 +917,8 @@
 
         (scheme, user, password,
          host, port, path) = transport.ConnectedTransport._split_url(proxy)
+        if not host:
+            raise errors.InvalidURL(proxy, 'No host component')
 
         if request.proxy_auth == {}:
             # No proxy auth parameter are available, we are handling the first




More information about the bazaar-commits mailing list