Rev 4048: (robertc) Remove a wasted round trip determining whether a repository in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Feb 25 06:35:32 GMT 2009


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

------------------------------------------------------------
revno: 4048
revision-id: pqm at pqm.ubuntu.com-20090225063528-m6c41lna1xu4bdwm
parent: pqm at pqm.ubuntu.com-20090225055516-t60b3kldpw95bn1a
parent: robertc at robertcollins.net-20090225053618-k61xgj03grhy1iyi
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-02-25 06:35:28 +0000
message:
  (robertc) Remove a wasted round trip determining whether a repository
  	wants working trees made when we cannot create a working tree
  	anyway due to the bzrdir being on a non-local path. (Robert Collins)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
    ------------------------------------------------------------
    revno: 4044.1.5
    revision-id: robertc at robertcollins.net-20090225053618-k61xgj03grhy1iyi
    parent: robertc at robertcollins.net-20090225050651-q8g8zdj5esyn2yel
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: push.roundtrips
    timestamp: Wed 2009-02-25 16:36:18 +1100
    message:
      Stop trying to create working trees during clone when the target bzrdir cannot have a local abspath created for it.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
=== modified file 'NEWS'
--- a/NEWS	2009-02-25 03:22:12 +0000
+++ b/NEWS	2009-02-25 05:36:18 +0000
@@ -93,9 +93,6 @@
       a RemoteRepository uses this to stream the operation.
       (Andrew Bennetts, Robert Collins)
 
-    * There is a RemoteSink object which handles pushing to smart servers.
-      (Andrew Bennetts, Robert Collins)
-
     * ``bzrlib.tests.run_suite`` accepts a runner_class parameter
       supporting the use of different runners. (Robert Collins)
 
@@ -130,12 +127,19 @@
       delta references. The method is ``scan_unvalidated_index``.
       (Andrew Bennetts, Robert Collins)
 
+    * There is a RemoteSink object which handles pushing to smart servers.
+      (Andrew Bennetts, Robert Collins)
+
     * ``VersionedFiles`` record adapters have had their signature change
       from ``(record, record.get_bytes_as(record.storage_kind))`` to
       ``(record)`` reducing excess duplication and allowing adapters
       to access private data in record to obtain content more
       efficiently. (Robert Collins)
 
+    * We no longer probe to see if we should create a working tree during
+      clone if we cannot get a local_abspath for the new bzrdir.
+      (Robert Collins)
+
 
 bzr 1.12 "1234567890" 2009-02-13
 --------------------------------

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2009-02-24 09:13:04 +0000
+++ b/bzrlib/bzrdir.py	2009-02-25 05:36:18 +0000
@@ -232,11 +232,14 @@
             result_branch = local_branch.clone(result, revision_id=revision_id)
             if repository_policy is not None:
                 repository_policy.configure_branch(result_branch)
-        if result_repo is None or result_repo.make_working_trees():
-            try:
+        try:
+            # Cheaper to check if the target is not local, than to try making
+            # the tree and fail.
+            result.root_transport.local_abspath('.')
+            if result_repo is None or result_repo.make_working_trees():
                 self.open_workingtree().clone(result)
-            except (errors.NoWorkingTree, errors.NotLocalUrl):
-                pass
+        except (errors.NoWorkingTree, errors.NotLocalUrl):
+            pass
         return result
 
     # TODO: This should be given a Transport, and should chdir up; otherwise

=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py	2009-02-25 05:06:51 +0000
+++ b/bzrlib/tests/blackbox/test_push.py	2009-02-25 05:36:18 +0000
@@ -202,7 +202,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
-        self.assertEqual(28, rpc_count)
+        self.assertEqual(27, rpc_count)
 
     def test_push_smart_stacked_streaming_acceptance(self):
         self.setup_smart_server_with_call_log()
@@ -219,7 +219,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
-        self.assertEqual(55, rpc_count)
+        self.assertEqual(54, rpc_count)
         remote = Branch.open('public')
         self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
 




More information about the bazaar-commits mailing list