Rev 3222: * Repository formats have a new supported-feature attribute in http://people.ubuntu.com/~robertc/baz2.0/shallow-branch

Robert Collins robertc at robertcollins.net
Tue Feb 12 02:40:00 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/shallow-branch

------------------------------------------------------------
revno: 3222
revision-id:robertc at robertcollins.net-20080212023827-019lghqbrm3tukgl
parent: pqm at pqm.ubuntu.com-20080208064756-bg0zu0y4e789j50r
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository-stackable-flag
timestamp: Tue 2008-02-12 13:38:27 +1100
message:
   * Repository formats have a new supported-feature attribute
     ``supports_external_lookups`` used to indicate repositories which support
     falling back to other repositories when they have partial data.
     (Robert Collins)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repofmt/weaverepo.py    presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
=== modified file 'NEWS'
--- a/NEWS	2008-02-07 06:59:48 +0000
+++ b/NEWS	2008-02-12 02:38:27 +0000
@@ -181,14 +181,19 @@
     * ``RemoteBzrDir._get_tree_branch`` no longer triggers ``_ensure_real``,
       removing one round trip on many network operations. (Robert Collins)
 
+    * RemoteTransport's ``recommended_page_size`` method now returns 64k, like
+      SFTPTransport and HttpTransportBase.  (Andrew Bennetts)
+
+    * Repository formats have a new supported-feature attribute
+      ``supports_external_lookups`` used to indicate repositories which support
+      falling back to other repositories when they have partial data.
+      (Robert Collins)
+
     * Repository has a new method ``has_revisions`` which signals the presence
       of many revisions by returning a set of the revisions listed which are
       present. This can be done by index queries without reading data for parent
       revision names etc. (Robert Collins)
 
-    * RemoteTransport's ``recommended_page_size`` method now returns 64k, like
-      SFTPTransport and HttpTransportBase.  (Andrew Bennetts)
-
 
 bzr 1.1 2008-01-15
 ------------------

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2008-02-07 03:47:24 +0000
+++ b/bzrlib/remote.py	2008-02-12 02:38:27 +0000
@@ -158,6 +158,8 @@
             format = RemoteRepositoryFormat()
             format.rich_root_data = (response[2] == 'yes')
             format.supports_tree_reference = (response[3] == 'yes')
+            # No wire format to check this yet.
+            format.supports_external_lookups = False
             return RemoteRepository(self, format)
         else:
             raise errors.NoRepositoryPresent(self)
@@ -284,6 +286,9 @@
         self._reconcile_fixes_text_parents = False
         self._reconcile_backsup_inventory = False
         self.base = self.bzrdir.transport.base
+        # Can this repository be given external locations to lookup additional
+        # data.
+        self.supports_external_lookups = False
 
     def __str__(self):
         return "%s(%s)" % (self.__class__.__name__, self.base)

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2008-01-17 05:30:53 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2008-02-12 02:38:27 +0000
@@ -354,6 +354,8 @@
     _serializer = xml5.serializer_v5
     # Knit based repositories handle ghosts reasonably well.
     supports_ghosts = True
+    # External lookups are not supported in this format.
+    supports_external_lookups = False
 
     def _get_control_store(self, repo_transport, control_files):
         """Return the control store for this repository."""

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2008-01-11 03:54:51 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2008-02-12 02:38:27 +0000
@@ -2055,6 +2055,8 @@
     # Set this attribute in derived clases to control the _serializer that the
     # repository objects will have passed to their constructor.
     _serializer = None
+    # External references are not supported in pack repositories yet.
+    supports_external_lookups = False
 
     def _get_control_store(self, repo_transport, control_files):
         """Return the control store for this repository."""

=== modified file 'bzrlib/repofmt/weaverepo.py'
--- a/bzrlib/repofmt/weaverepo.py	2008-01-11 03:54:51 +0000
+++ b/bzrlib/repofmt/weaverepo.py	2008-02-12 02:38:27 +0000
@@ -338,6 +338,7 @@
     rich_root_data = False
     supports_tree_reference = False
     supports_ghosts = False
+    supports_external_lookups = False
 
     def initialize(self, a_bzrdir, shared=False, _internal=False):
         """Create a weave repository."""

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-02-04 22:01:14 +0000
+++ b/bzrlib/repository.py	2008-02-12 02:38:27 +0000
@@ -2090,6 +2090,9 @@
     # Set to True or False in derived classes. True indicates that the format
     # supports ghosts gracefully.
     supports_ghosts = None
+    # Can this repository be given external locations to lookup additional
+    # data. Set to True or False in derived classes.
+    supports_external_lookups = None
 
     def __str__(self):
         return "<%s>" % self.__class__.__name__
@@ -2234,6 +2237,7 @@
 
     rich_root_data = False
     supports_tree_reference = False
+    supports_external_lookups = False
     _matchingbzrdir = bzrdir.BzrDirMetaFormat1()
 
     def __init__(self):

=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py	2008-02-06 00:06:53 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py	2008-02-12 02:38:27 +0000
@@ -267,6 +267,11 @@
         text = repo._format.get_format_description()
         self.failUnless(len(text))
 
+    def test_format_supports_external_lookups(self):
+        repo = self.make_repository('.')
+        self.assertSubset(
+            [repo._format.supports_external_lookups], (True, False))
+
     def assertMessageRoundtrips(self, message):
         """Assert that message roundtrips to a repository and back intact."""
         tree = self.make_branch_and_tree('.')

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2008-01-17 05:30:53 +0000
+++ b/bzrlib/tests/test_repository.py	2008-02-12 02:38:27 +0000
@@ -176,6 +176,11 @@
         self.assertRaises(errors.OutSideTransaction,
             inv.add_lines, 'foo', [], [])
 
+    def test_supports_external_lookups(self):
+        control = bzrdir.BzrDirFormat6().initialize(self.get_url())
+        repo = weaverepo.RepositoryFormat6().initialize(control)
+        self.assertFalse(repo._format.supports_external_lookups)
+
 
 class TestFormat7(TestCaseWithTransport):
     
@@ -289,6 +294,11 @@
         self.assertRaises(errors.OutSideTransaction,
             inv.add_lines, 'foo', [], [])
 
+    def test_supports_external_lookups(self):
+        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
+        repo = weaverepo.RepositoryFormat7().initialize(control)
+        self.assertFalse(repo._format.supports_external_lookups)
+
 
 class TestFormatKnit1(TestCaseWithTransport):
     
@@ -404,6 +414,11 @@
         inv = repo.deserialise_inventory('other-rev-id', inv_xml)
         self.assertEqual('other-rev-id', inv.root.revision)
 
+    def test_supports_external_lookups(self):
+        repo = self.make_repository('.',
+                format=bzrdir.format_registry.get('knit')())
+        self.assertFalse(repo._format.supports_external_lookups)
+
 
 class KnitRepositoryStreamTests(test_knit.KnitTests):
     """Tests for knitrepo._get_stream_as_bytes."""
@@ -677,6 +692,12 @@
         self.assertRaises(errors.OutSideTransaction,
             inv.add_lines, 'foo', [], [])
 
+    def test_supports_external_lookups(self):
+        format = bzrdir.BzrDirMetaFormat1()
+        format.repository_format = knitrepo.RepositoryFormatKnit3()
+        repo = self.make_repository('.', format=format)
+        self.assertFalse(repo._format.supports_external_lookups)
+
 
 class TestWithBrokenRepo(TestCaseWithTransport):
     """These tests seem to be more appropriate as interface tests?"""
@@ -1171,6 +1192,10 @@
         self.assertRaises(errors.RevisionNotPresent,
             missing_ghost.get_inventory, 'ghost')
 
+    def test_supports_external_lookups(self):
+        repo = self.make_repository('.', format=self.get_format())
+        self.assertFalse(repo._format.supports_external_lookups)
+
 
 class TestKnitPackSubtrees(TestKnitPackNoSubtrees):
 



More information about the bazaar-commits mailing list