Rev 2189: More Branch implementation test passing foo. in http://bazaar.launchpad.net/~bzr/bzr/hpss

Robert Collins robertc at robertcollins.net
Thu Mar 29 05:09:18 BST 2007


At http://bazaar.launchpad.net/~bzr/bzr/hpss

------------------------------------------------------------
revno: 2189
revision-id: robertc at robertcollins.net-20070329040816-w9220t3gkdb45n3i
parent: andrew.bennetts at canonical.com-20070329025245-8wdjghnbgjcp9mxy
committer: Robert Collins <robertc at robertcollins.net>
branch nick: hpss
timestamp: Thu 2007-03-29 14:08:16 +1000
message:
  More Branch implementation test passing foo.
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/tests/branch_implementations/test_create_checkout.py test_create_checkout-20070322193723-n2wkp1g03r0404di-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2007-03-28 08:49:06 +0000
+++ b/bzrlib/branch.py	2007-03-29 04:08:16 +0000
@@ -811,6 +811,18 @@
         """Return the current default format."""
         return klass._default_format
 
+    def get_reference(self, a_bzrdir):
+        """Get the target reference of the branch in a_bzrdir.
+
+        format probing must have been completed before calling
+        this method - it is assumed that the format of the branch
+        in a_bzrdir is correct.
+
+        :param a_bzrdir: The bzrdir to get the branch data from.
+        :return: None if the branch is not a reference branch.
+        """
+        return None
+
     def get_format_string(self):
         """Return the ASCII format string that identifies this format."""
         raise NotImplementedError(self.get_format_string)
@@ -819,18 +831,6 @@
         """Return the short format description for this format."""
         raise NotImplementedError(self.get_format_description)
 
-    def get_reference(self, a_bzrdir):
-        """Get the target reference of the branch in a_bzrdir.
-
-        format probing must have been completed before calling
-        this method - it is assumed that the format of the branch
-        in a_bzrdir is correct.
-
-        :param a_bzrdir: The bzrdir to get the branch data from.
-        :return: None if the branch is not a reference branch.
-        """
-        return None
-
     def _initialize_helper(self, a_bzrdir, utf8_files, lock_type='metadir',
                            set_format=True):
         """Initialize a branch in a bzrdir, with specified files
@@ -1783,6 +1783,19 @@
         return "Experimental branch format"
 
     @classmethod
+    def get_reference(cls, a_bzrdir):
+        """Get the target reference of the branch in a_bzrdir.
+
+        format probing must have been completed before calling
+        this method - it is assumed that the format of the branch
+        in a_bzrdir is correct.
+
+        :param a_bzrdir: The bzrdir to get the branch data from.
+        :return: None if the branch is not a reference branch.
+        """
+        return None
+
+    @classmethod
     def _initialize_control_files(cls, a_bzrdir, utf8_files, lock_filename,
             lock_class):
         branch_transport = a_bzrdir.get_branch_transport(cls)

=== modified file 'bzrlib/tests/branch_implementations/test_create_checkout.py'
--- a/bzrlib/tests/branch_implementations/test_create_checkout.py	2007-03-22 19:41:59 +0000
+++ b/bzrlib/tests/branch_implementations/test_create_checkout.py	2007-03-29 04:08:16 +0000
@@ -19,6 +19,7 @@
 from bzrlib import (
     branch,
     )
+from bzrlib.remote import RemoteBranch
 from bzrlib.tests.branch_implementations.test_branch import TestCaseWithBranch
 
 
@@ -27,6 +28,14 @@
     def test_checkout_format(self):
         """Make sure the new checkout uses the same branch format."""
         a_branch = self.make_branch('branch')
+        if isinstance(a_branch, RemoteBranch):
+            # RemoteBranch formats are not the same as local ones, and dont
+            # duplicate the format string (because there is no format string as
+            # such - it might be e.g. totally virtual on the server end).
+            # This test can only assess the checkout format correctness *in
+            # general* when there is a real object locally present for both the
+            # source and target.
+            return
         tree = a_branch.create_checkout('checkout')
         if self.branch_format in branch._legacy_formats:
             # Legacy formats create checkouts with the default format.
@@ -34,8 +43,8 @@
             expected_format = branch.BranchFormat.get_default_format()
         else:
             expected_format = a_branch._format
-        self.assertEqual(expected_format.get_format_string(),
-                         tree.branch._format.get_format_string())
+        self.assertEqual(expected_format.__class__,
+                         tree.branch._format.__class__)
 
     def test_create_revision_checkout(self):
         """Test that we can create a checkout from an earlier revision."""



More information about the bazaar-commits mailing list