Rev 5298: ``bzrlib.branch.InterBranch._get_branch_formats_to_test`` now returns in http://bazaar.launchpad.net/~lifeless/bzr/loomsupport

Robert Collins robertc at robertcollins.net
Wed Jun 16 09:17:58 BST 2010


At http://bazaar.launchpad.net/~lifeless/bzr/loomsupport

------------------------------------------------------------
revno: 5298
revision-id: robertc at robertcollins.net-20100616081750-a5fmqmzqmcmefuo0
parent: pqm at pqm.ubuntu.com-20100615101932-2r8oodhzh49yhhjh
committer: Robert Collins <robertc at robertcollins.net>
branch nick: loomsupport
timestamp: Wed 2010-06-16 20:17:50 +1200
message:
  ``bzrlib.branch.InterBranch._get_branch_formats_to_test`` now returns
  an iterable of format pairs, rather than just a single pair, permitting
  InterBranch objects that work with multiple permutations to be
  comprehensively tested. (Robert Collins)
=== modified file 'NEWS'
--- a/NEWS	2010-06-15 07:44:29 +0000
+++ b/NEWS	2010-06-16 08:17:50 +0000
@@ -91,8 +91,12 @@
 
 * ``bzrlib.knit.KnitSequenceMatcher``, which has been deprecated since
   2007, has been deleted.  Use ``PatienceSequenceMatcher`` from
-  ``bzrlib.patiencediff`` instead.
-  (Andrew Bennetts)
+  ``bzrlib.patiencediff`` instead. (Andrew Bennetts)
+
+* ``bzrlib.branch.InterBranch._get_branch_formats_to_test`` now returns
+  an iterable of format pairs, rather than just a single pair, permitting
+  InterBranch objects that work with multiple permutations to be
+  comprehensively tested. (Robert Collins)
 
 Internals
 *********

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2010-06-14 21:41:32 +0000
+++ b/bzrlib/branch.py	2010-06-16 08:17:50 +0000
@@ -3185,10 +3185,15 @@
     _optimisers = []
     """The available optimised InterBranch types."""
 
-    @staticmethod
-    def _get_branch_formats_to_test():
-        """Return a tuple with the Branch formats to use when testing."""
-        raise NotImplementedError(InterBranch._get_branch_formats_to_test)
+    @classmethod
+    def _get_branch_formats_to_test(klass):
+        """Return an iterable of format tuples for testing.
+        
+        :return: An iterable of (from_format, to_format) to use when testing
+            this InterBranch class. Each InterBranch class should define this
+            method itself.
+        """
+        raise NotImplementedError(klass._get_branch_formats_to_test)
 
     def pull(self, overwrite=False, stop_revision=None,
              possible_transports=None, local=False):
@@ -3230,9 +3235,9 @@
         # GenericBranch uses the public API, so always compatible
         return True
 
-    @staticmethod
-    def _get_branch_formats_to_test():
-        return BranchFormat._default_format, BranchFormat._default_format
+    @classmethod
+    def _get_branch_formats_to_test(klass):
+        return [(BranchFormat._default_format, BranchFormat._default_format)]
 
     @classmethod
     def unwrap_format(klass, format):

=== modified file 'bzrlib/tests/per_interbranch/__init__.py'
--- a/bzrlib/tests/per_interbranch/__init__.py	2010-06-14 06:57:25 +0000
+++ b/bzrlib/tests/per_interbranch/__init__.py	2010-06-16 08:17:50 +0000
@@ -76,11 +76,9 @@
     # test the default InterBranch between format 6 and the current
     # default format.
     for optimiser_class in InterBranch._optimisers:
-        format_from_test, format_to_test = \
-            optimiser_class._get_branch_formats_to_test()
-        if format_to_test is not None:
-            result.append((optimiser_class,
-                           format_from_test, format_to_test))
+        for format_from_test, format_to_test in \
+            optimiser_class._get_branch_formats_to_test():
+            result.append((optimiser_class, format_from_test, format_to_test))
     # if there are specific combinations we want to use, we can add them
     # here.
     return result




More information about the bazaar-commits mailing list