Rev 3930: Track down the other cause of us connecting multiple times. in http://bzr.arbash-meinel.com/branches/bzr/1.11/stacking_tweaks

John Arbash Meinel john at arbash-meinel.com
Thu Jan 8 19:49:09 GMT 2009


At http://bzr.arbash-meinel.com/branches/bzr/1.11/stacking_tweaks

------------------------------------------------------------
revno: 3930
revision-id: john at arbash-meinel.com-20090108194848-93vcyrrg1snzqqjd
parent: john at arbash-meinel.com-20090108191520-ymp6abkgwvkz297o
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: stacking_tweaks
timestamp: Thu 2009-01-08 13:48:48 -0600
message:
  Track down the other cause of us connecting multiple times.
  
  The repository acquisition policy objects weren't re-using the connections that
  they knew about. This has been fixed.
  
  Now 'bzr push' connects a single time, rather than connecting 4 times when
  creating a new stacked-on branch, or 2 times for an existing stacked-on
  branch.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-01-08 19:15:20 +0000
+++ b/NEWS	2009-01-08 19:48:48 +0000
@@ -48,13 +48,12 @@
 
   BUG FIXES:
   
-    * Fix a problem with CIFS client/server lag on windows colliding with
-      an invariant-per-process algorithm for generating AtomicFile names
-      (Adrian Wilkins, #304023)
-
     * Allow BzrDir implementation to implement backing up of 
       control directory. (#139691)
 
+    * ``bzr push`` creating a new stacked branch will now only open a
+      single connection to the target machine. (John Arbash Meinel)
+
     * Don't call iteritems on transport_list_registry, because it may
       change during iteration.  (Martin Pool, #277048)
 
@@ -65,6 +64,10 @@
     * Don't require embedding user in HTTP(S) URLs do use authentication.conf.
       (Ben Jansen, Vincent Ladeuil, #300347)
 
+    * Fix a problem with CIFS client/server lag on windows colliding with
+      an invariant-per-process algorithm for generating AtomicFile names
+      (Adrian Wilkins, #304023)
+
     * Fix bogus setUp signature in UnavailableFTPServer.
       (Gary van der Merwe, #313498)
 

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2008-12-23 03:44:45 +0000
+++ b/bzrlib/bzrdir.py	2009-01-08 19:48:48 +0000
@@ -2902,12 +2902,13 @@
         else:
             return urlutils.join(self._stack_on_pwd, self._stack_on)
 
-    def _add_fallback(self, repository):
+    def _add_fallback(self, repository, possible_transports=None):
         """Add a fallback to the supplied repository, if stacking is set."""
         stack_on = self._get_full_stack_on()
         if stack_on is None:
             return
-        stacked_dir = BzrDir.open(stack_on)
+        stacked_dir = BzrDir.open(stack_on,
+                                  possible_transports=possible_transports)
         try:
             stacked_repo = stacked_dir.open_branch().repository
         except errors.NotBranchError:
@@ -2955,7 +2956,8 @@
         Creates the desired repository in the bzrdir we already have.
         """
         repository = self._bzrdir.create_repository(shared=shared)
-        self._add_fallback(repository)
+        self._add_fallback(repository,
+                           possible_transports=[self._bzrdir.transport])
         if make_working_trees is not None:
             repository.set_make_working_trees(make_working_trees)
         return repository
@@ -2982,7 +2984,8 @@
 
         Returns an existing repository to use
         """
-        self._add_fallback(self._repository)
+        self._add_fallback(self._repository,
+                       possible_transports=[self._repository.bzrdir.transport])
         return self._repository
 
 

=== modified file 'bzrlib/tests/commands/test_push.py'
--- a/bzrlib/tests/commands/test_push.py	2008-06-06 02:20:29 +0000
+++ b/bzrlib/tests/commands/test_push.py	2009-01-08 19:48:48 +0000
@@ -32,3 +32,15 @@
         cmd.outf = tests.StringIOWrapper()
         cmd.run(self.get_url('remote'), directory='branch')
         self.assertEquals(1, len(self.connections))
+
+    def test_push_onto_stacked(self):
+        self.make_branch_and_tree('base', format='1.9')
+        self.make_branch_and_tree('source', format='1.9')
+
+        self.start_logging_connections()
+
+        cmd = cmd_push()
+        cmd.outf = tests.StringIOWrapper()
+        cmd.run(self.get_url('remote'), directory='source',
+                stacked_on=self.get_url('base'))
+        self.assertEqual(1, len(self.connections))



More information about the bazaar-commits mailing list