Rev 3254: Add test that we can stack on a smart server from Jonathan Lange. in http://people.ubuntu.com/~robertc/baz2.0/shallow-branch

Robert Collins robertc at robertcollins.net
Wed Jun 25 06:04:18 BST 2008


At http://people.ubuntu.com/~robertc/baz2.0/shallow-branch

------------------------------------------------------------
revno: 3254
revision-id: robertc at robertcollins.net-20080625050414-lnh43c39hc0phcev
parent: robertc at robertcollins.net-20080625050005-09vero5o83tkll2n
committer: Robert Collins <robertc at robertcollins.net>
branch nick: branch.shallow
timestamp: Wed 2008-06-25 15:04:14 +1000
message:
  Add test that we can stack on a smart server from Jonathan Lange.
modified:
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2008-06-25 04:49:30 +0000
+++ b/bzrlib/remote.py	2008-06-25 05:04:14 +0000
@@ -181,6 +181,8 @@
             format.supports_tree_reference = (response[3] == 'yes')
             # No wire format to check this yet.
             format.supports_external_lookups = (response[4] == 'yes')
+            # Used to support creating a real format instance when needed.
+            format._creating_bzrdir = self
             return RemoteRepository(self, format)
         else:
             raise errors.NoRepositoryPresent(self)
@@ -239,7 +241,10 @@
 
     def initialize(self, a_bzrdir, shared=False):
         if not isinstance(a_bzrdir, RemoteBzrDir):
-            raise AssertionError('%r is not a RemoteBzrDir' % (a_bzrdir,))
+            prior_repo = self._creating_bzrdir.open_repository()
+            prior_repo._ensure_real()
+            return prior_repo._real_repository._format.initialize(
+                a_bzrdir, shared=shared)
         return a_bzrdir.create_repository(shared=shared)
     
     def open(self, a_bzrdir):

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py	2008-06-10 05:11:40 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py	2008-06-25 05:04:14 +0000
@@ -143,6 +143,14 @@
         new_revid = new_tree.commit('new work')
         self.assertShallow(new_revid, trunk_tree.branch.base)
 
+    def test_branch_stacked_from_smart_server(self):
+        # We can branch stacking on a smart server
+        from bzrlib.smart.server import SmartTCPServer_for_testing
+        self.transport_server = SmartTCPServer_for_testing
+        trunk = self.make_branch('mainline', format='development')
+        out, err = self.run_bzr(
+            ['branch', '--stacked', self.get_url('mainline'), 'shallow'])
+
 
 class TestRemoteBranch(TestCaseWithSFTPServer):
 




More information about the bazaar-commits mailing list