[MERGE] Use repo.supports_rich_root() rather than repo._format.rich_root_data

Andrew Bennetts andrew at canonical.com
Thu Mar 1 04:19:42 GMT 2007


As explained in the commit message, this bundle makes a small change that helps
the smart server work.

Incidentally, I have all repository_implementations tests passing on the hpss
branch now.

-Andrew.

-------------- next part --------------
# Bazaar revision bundle v0.9
#
# message:
#   Use repo.supports_rich_root() everywhere rather than
#   repo._format.rich_root_data.
#   
#   This is needed for the smart server work, because a RemoteRepository's _format
#   doesn't know whether or not the actual repository supports rich root data or
#   not.  But the RemoteRepository does (by asking the underlying repository it is
#   connected to).
#   
#   This also removes some unnecessary isinstance(..., Repository), which also
#   hinders smart server work, because RemoteRepository doesn't inherit from
#   Repository, even though it implements the same interface.
#   
# committer: Andrew Bennetts <andrew.bennetts at canonical.com>
# date: Thu 2007-03-01 14:58:39.548000097 +1100

=== modified file bzrlib/repository.py
--- bzrlib/repository.py
+++ bzrlib/repository.py
@@ -1330,11 +1330,7 @@
 
     @staticmethod
     def is_compatible(source, target):
-        if not isinstance(source, Repository):
-            return False
-        if not isinstance(target, Repository):
-            return False
-        if source._format.rich_root_data == target._format.rich_root_data:
+        if source.supports_rich_root() == target.supports_rich_root():
             return True
         else:
             return False
@@ -1587,11 +1583,7 @@
 
     @staticmethod
     def is_compatible(source, target):
-        if not isinstance(source, Repository):
-            return False
-        if not isinstance(target, Repository):
-            return False
-        if not source._format.rich_root_data and target._format.rich_root_data:
+        if not source.supports_rich_root() and target.supports_rich_root():
             return True
         else:
             return False

=== modified file bzrlib/tests/repository_implementations/test_commit_builder.p
... y
--- bzrlib/tests/repository_implementations/test_commit_builder.py
+++ bzrlib/tests/repository_implementations/test_commit_builder.py
@@ -82,7 +82,7 @@
     def test_commit_without_root(self):
         """This should cause a deprecation warning, not an assertion failure"""
         tree = self.make_branch_and_tree(".")
-        if tree.branch.repository._format.rich_root_data:
+        if tree.branch.repository.supports_rich_root():
             raise tests.TestSkipped('Format requires root')
         self.build_tree(['foo'])
         tree.add('foo', 'foo-id')

=== modified file bzrlib/tests/repository_implementations/test_repository.py
--- bzrlib/tests/repository_implementations/test_repository.py
+++ bzrlib/tests/repository_implementations/test_repository.py
@@ -181,8 +181,8 @@
         tree_a.commit('rev1', rev_id='rev1')
         # fetch with a default limit (grab everything)
         repo = bzrdir.BzrDir.create_repository(self.get_url('b'))
-        if (tree_a.branch.repository._format.rich_root_data and not
-            repo._format.rich_root_data):
+        if (tree_a.branch.repository.supports_rich_root() and not
+            repo.supports_rich_root()):
             raise TestSkipped('Cannot fetch from model2 to model1')
         repo.fetch(tree_a.branch.repository,
                    revision_id=None,

=== modified directory  // last-changed:andrew.bennetts at canonical.com-200703010
... 35839-mgsenxqgx4oveeob
# revision id: andrew.bennetts at canonical.com-20070301035839-mgsenxqgx4oveeob
# sha1: 77f3c8ae7e20ef8b6f2d8810ed930ce272c25b68
# inventory sha1: 5d9b99d7fca80880d1b1101c54713200b3787e7d
# parent ids:
#   pqm at pqm.ubuntu.com-20070228211048-30e18ddd8dd9c205
# base id: pqm at pqm.ubuntu.com-20070228211048-30e18ddd8dd9c205
# properties:
#   branch-nick: supports-rich-root



More information about the bazaar mailing list