Rev 2154: Make make_branch_and_tree fall back to creating a local checkout if the transport doesn't support working trees, allowing several more Remote tests to pass. in sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

Andrew Bennetts andrew.bennetts at canonical.com
Mon Mar 5 07:39:48 GMT 2007


At sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

------------------------------------------------------------
revno: 2154
revision-id: andrew.bennetts at canonical.com-20070305073349-dr29xzo4jxj5niz5
parent: andrew.bennetts at canonical.com-20070305070421-y8wp2a7j7ymymyyk
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: hpss
timestamp: Mon 2007-03-05 18:33:49 +1100
message:
  Make make_branch_and_tree fall back to creating a local checkout if the transport doesn't support working trees, allowing several more Remote tests to pass.
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2007-03-01 05:08:32 +0000
+++ b/bzrlib/branch.py	2007-03-05 07:33:49 +0000
@@ -654,9 +654,10 @@
 
     def _get_checkout_format(self):
         """Return the most suitable metadir for a checkout of this branch.
-        Weaves are used if this branch's repostory uses weaves.
+        Weaves are used if this branch's repository uses weaves.
         """
-        if isinstance(self.bzrdir, bzrdir.BzrDirPreSplitOut):
+        from bzrlib.remote import RemoteBzrDir
+        if isinstance(self.bzrdir, (bzrdir.BzrDirPreSplitOut, RemoteBzrDir)):
             from bzrlib.repofmt import weaverepo
             format = bzrdir.BzrDirMetaFormat1()
             format.repository_format = weaverepo.RepositoryFormat7()

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-03-01 05:08:32 +0000
+++ b/bzrlib/tests/__init__.py	2007-03-05 07:33:49 +0000
@@ -1652,7 +1652,7 @@
 
         This will fail if the original default transport for this test
         case wasn't backed by the working directory, as the branch won't
-        be on disk for us to open it.  
+        be on disk for us to open it.
 
         :param format: The BzrDirFormat.
         :returns: the WorkingTree.
@@ -1666,13 +1666,11 @@
             return b.bzrdir.create_workingtree()
         except errors.NotLocalUrl:
             # We can only make working trees locally at the moment.  If the
-            # transport can't support them, then reopen the branch on a local
-            # transport, and create the working tree there.  
-            #
-            # Possibly we should instead keep
-            # the non-disk-backed branch and create a local checkout?
-            bd = bzrdir.BzrDir.open(relpath)
-            return bd.create_workingtree()
+            # transport can't support them, then we keep the non-disk-backed
+            # branch and create a local checkout.
+            if not os.path.exists('_checkouts'):
+                os.mkdir('_checkouts')
+            return b.create_checkout('_checkouts/' + relpath)
 
     def assertIsDirectory(self, relpath, transport):
         """Assert that relpath within transport is a directory.




More information about the bazaar-commits mailing list