Rev 6509: Set up the infrastructure to start testing a lightweight checkout of a remote repository. in http://bazaar.launchpad.net/~jameinel/bzr/2.5-remote-wt-tests-1046697

John Arbash Meinel john at arbash-meinel.com
Thu Sep 6 08:05:45 UTC 2012


At http://bazaar.launchpad.net/~jameinel/bzr/2.5-remote-wt-tests-1046697

------------------------------------------------------------
revno: 6509
revision-id: john at arbash-meinel.com-20120906080521-wps0xwo64iea7fph
parent: pqm at pqm.ubuntu.com-20120905192959-r312gx2awcoitph0
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.5-remote-wt-tests-1046697
timestamp: Thu 2012-09-06 12:05:21 +0400
message:
  Set up the infrastructure to start testing a lightweight checkout of a remote repository.
  
  Now some tests are failing which are genuine bugs. So start going through the
  test failures and fix them.
-------------- next part --------------
=== modified file 'bzrlib/tests/per_workingtree/__init__.py'
--- a/bzrlib/tests/per_workingtree/__init__.py	2011-09-23 12:32:30 +0000
+++ b/bzrlib/tests/per_workingtree/__init__.py	2012-09-06 08:05:21 +0000
@@ -25,9 +25,14 @@
 from bzrlib import (
     branchbuilder,
     tests,
+    transport,
     workingtree,
     )
-from bzrlib.tests import per_controldir
+from bzrlib.transport import memory
+from bzrlib.tests import (
+    per_controldir,
+    test_server,
+    )
 
 
 def make_scenarios(transport_server, transport_readonly_server, formats):
@@ -37,6 +42,13 @@
                        make_scenario(transport_server,
                                      transport_readonly_server,
                                      workingtree_format)))
+    default_wt_format = workingtree.format_registry.get_default()
+    scenario = make_scenario(test_server.SmartTCPServer_for_testing,
+                      test_server.ReadonlySmartTCPServer_for_testing,
+                      default_wt_format)
+    scenario['repo_is_remote'] = True;
+    scenario['vfs_transport_factory'] = memory.MemoryServer
+    result.append((default_wt_format.__class__.__name__ + ',remote', scenario))
     return result
 
 
@@ -47,6 +59,7 @@
         "transport_readonly_server": transport_readonly_server,
         "bzrdir_format": workingtree_format._matchingbzrdir,
         "workingtree_format": workingtree_format,
+        "repo_is_remote": False,
         }
 
 
@@ -71,8 +84,22 @@
     def make_branch_and_tree(self, relpath, format=None):
         made_control = self.make_bzrdir(relpath, format=format)
         made_control.create_repository()
-        made_control.create_branch()
-        return self.workingtree_format.initialize(made_control)
+        b = made_control.create_branch()
+        if self.repo_is_remote:
+            # If the repo is remote, then we just create a local lightweight
+            # checkout
+            # XXX: This duplicates a lot of Branch.create_checkout, but we know
+            #      we want a) lightweight, and b) a specific WT format. We also
+            #      know that nothing should already exist, etc.
+            t = transport.get_transport(relpath)
+            t.ensure_base()
+            bzrdir_format = self.workingtree_format.get_controldir_for_branch()
+            wt_dir = bzrdir_format.initialize_on_transport(t)
+            branch_ref = wt_dir.set_branch_reference(b)
+            wt = wt_dir.create_workingtree(None, from_branch=branch_ref)
+        else:
+            wt = self.workingtree_format.initialize(made_control)
+        return wt
 
     def make_branch_builder(self, relpath, format=None):
         if format is None:

=== modified file 'bzrlib/tests/per_workingtree/test_commit.py'
--- a/bzrlib/tests/per_workingtree/test_commit.py	2012-01-25 21:13:15 +0000
+++ b/bzrlib/tests/per_workingtree/test_commit.py	2012-09-06 08:05:21 +0000
@@ -26,6 +26,7 @@
     osutils,
     revision as _mod_revision,
     tests,
+    transport as _mod_transport,
     ui,
     )
 from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
@@ -316,7 +317,7 @@
         wt.lock_write()
         self.build_tree(['a', 'b/', 'b/c', 'd'])
         wt.add(['a', 'b', 'b/c', 'd'], ['a-id', 'b-id', 'c-id', 'd-id'])
-        this_dir = self.get_transport()
+        this_dir = wt.bzrdir.root_transport
         this_dir.delete_tree('b')
         this_dir.delete('d')
         # now we have a tree with a through d in the inventory, but only
@@ -352,7 +353,7 @@
         wt.add(['a', 'b', 'b/c'], ['a-id', 'b-id', 'c-id'])
         wt.commit('first')
         wt.remove('b/c')
-        this_dir = self.get_transport()
+        this_dir = wt.bzrdir.root_transport
         this_dir.delete_tree('b')
         wt.lock_write()
         wt.commit('commit deleted rename')



More information about the bazaar-commits mailing list