Rev 3771: Hook in CHKInventory to the intertree tests. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Thu Nov 13 06:32:43 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/repository

------------------------------------------------------------
revno: 3771
revision-id: robertc at robertcollins.net-20081113063210-73nygl2cftrvpibh
parent: robertc at robertcollins.net-20081113040626-s65f050j1is2nxt7
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Thu 2008-11-13 17:32:10 +1100
message:
  Hook in CHKInventory to the intertree tests.
modified:
  bzrlib/tests/intertree_implementations/__init__.py __init__.py-20060724101752-09ysswo1a92uqyoz-3
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/tests/intertree_implementations/__init__.py'
--- a/bzrlib/tests/intertree_implementations/__init__.py	2008-09-24 01:54:18 +0000
+++ b/bzrlib/tests/intertree_implementations/__init__.py	2008-11-13 06:32:10 +0000
@@ -42,6 +42,7 @@
 from bzrlib.workingtree import (
     WorkingTreeFormat3,
     )
+from bzrlib.workingtree_4 import WorkingTreeFormat4
 
 
 def return_provided_trees(test_case, source, target):
@@ -53,7 +54,7 @@
 
     def make_to_branch_and_tree(self, relpath):
         """Make a to_workingtree_format branch and tree."""
-        made_control = self.make_bzrdir(relpath, 
+        made_control = self.make_bzrdir(relpath,
             format=self.workingtree_format_to._matchingbzrdir)
         made_control.create_repository()
         made_control.create_branch()
@@ -99,6 +100,13 @@
     test_case.addCleanup(preview.finalize)
     return source, preview.get_preview_tree()
 
+
+def mutable_trees_to_revision_trees(test_case, source, target):
+    """Convert both trees to repository based revision trees."""
+    return (revision_tree_from_workingtree(test_case, source),
+        revision_tree_from_workingtree(test_case, target))
+
+
 def load_tests(basic_tests, module, loader):
     result = loader.suiteClass()
     # load the tests of the infrastructure for these tests
@@ -144,6 +152,16 @@
          default_tree_format,
          default_tree_format,
          mutable_trees_to_preview_trees))
+    # CHKInventory does not have an InterTree optimiser class (yet).
+    chk_tree_format = WorkingTreeFormat4()
+    chk_tree_format._get_matchingbzrdir = \
+        lambda:bzrlib.bzrdir.format_registry.make_bzrdir('development3')
+    test_intertree_permutations.append(
+        (InterTree.__name__ + "(CHKInventory)",
+         InterTree,
+         chk_tree_format,
+         chk_tree_format,
+         mutable_trees_to_revision_trees))
     adapter = InterTreeTestProviderAdapter(
         default_transport,
         # None here will cause a readonly decorator to be created

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2008-10-12 15:38:00 +0000
+++ b/bzrlib/workingtree_4.py	2008-11-13 06:32:10 +0000
@@ -1426,6 +1426,10 @@
                            _control_files=control_files)
 
     def __get_matchingbzrdir(self):
+        return self._get_matchingbzrdir()
+
+    def _get_matchingbzrdir(self):
+        """Overrideable method to get a bzrdir for testing."""
         # please test against something that will let us do tree references
         return bzrdir.format_registry.make_bzrdir(
             'dirstate-with-subtree')




More information about the bazaar-commits mailing list