Rev 5681: (jelmer) Add BzrDirFormat.fixed_components. (Jelmer Vernooij) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Feb 23 15:43:29 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5681 [merge]
revision-id: pqm at pqm.ubuntu.com-20110223154326-clehiyp17ffzo5o9
parent: pqm at pqm.ubuntu.com-20110223150327-d9k3rvhhy8ij3t4j
parent: jelmer at samba.org-20110223124056-ha7va3nm0fewzark
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-02-23 15:43:26 +0000
message:
  (jelmer) Add BzrDirFormat.fixed_components. (Jelmer Vernooij)
modified:
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/controldir.py           controldir.py-20100802102926-hvtvh0uae5epuibp-1
  bzrlib/tests/per_branch/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
  bzrlib/tests/per_branch/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
  bzrlib/tests/per_controldir/test_controldir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
  bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2011-02-23 13:15:21 +0000
+++ b/bzrlib/bzrdir.py	2011-02-23 15:43:26 +0000
@@ -1737,6 +1737,8 @@
 
     _lock_class = lockable_files.TransportLock
 
+    fixed_components = True
+
     def get_format_string(self):
         """See BzrDirFormat.get_format_string()."""
         return "Bazaar-NG branch, format 0.0.4\n"
@@ -1780,6 +1782,8 @@
 class BzrDirFormatAllInOne(BzrDirFormat):
     """Common class for formats before meta-dirs."""
 
+    fixed_components = True
+
     def initialize_on_transport_ex(self, transport, use_existing_dir=False,
         create_prefix=False, force_new_repo=False, stacked_on=None,
         stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
@@ -1938,6 +1942,8 @@
 
     _lock_class = lockdir.LockDir
 
+    fixed_components = False
+
     def __init__(self):
         self._workingtree_format = None
         self._branch_format = None

=== modified file 'bzrlib/controldir.py'
--- a/bzrlib/controldir.py	2011-02-19 00:33:36 +0000
+++ b/bzrlib/controldir.py	2011-02-23 12:40:56 +0000
@@ -672,6 +672,10 @@
     """Whether working trees can exist in control directories of this format.
     """
 
+    fixed_components = False
+    """Whether components can not change format independent of the control dir.
+    """
+
     def get_format_description(self):
         """Return the short description for this format."""
         raise NotImplementedError(self.get_format_description)

=== modified file 'bzrlib/tests/per_branch/test_push.py'
--- a/bzrlib/tests/per_branch/test_push.py	2011-02-21 22:43:53 +0000
+++ b/bzrlib/tests/per_branch/test_push.py	2011-02-23 15:43:26 +0000
@@ -209,7 +209,7 @@
         default for the branch), and will be stacked when the repo format
         allows (which means that the branch format isn't necessarly preserved).
         """
-        if isinstance(self.branch_format, branch.BzrBranchFormat4):
+        if self.bzrdir_format.fixed_components:
             raise tests.TestNotApplicable('Not a metadir format.')
         if isinstance(self.branch_format, branch.BranchReferenceFormat):
             # This test could in principle apply to BranchReferenceFormat, but

=== modified file 'bzrlib/tests/per_branch/test_stacking.py'
--- a/bzrlib/tests/per_branch/test_stacking.py	2011-02-21 22:43:53 +0000
+++ b/bzrlib/tests/per_branch/test_stacking.py	2011-02-23 15:43:26 +0000
@@ -329,7 +329,7 @@
 
     def test_sprout_stacking_policy_handling(self):
         """Obey policy where possible, ignore otherwise."""
-        if isinstance(self.branch_format, branch.BzrBranchFormat4):
+        if self.bzrdir_format.fixed_components:
             raise TestNotApplicable('Branch format 4 does not autoupgrade.')
         source = self.make_branch('source')
         stack_on = self.make_stacked_on_matching(source)
@@ -346,7 +346,7 @@
 
     def test_clone_stacking_policy_handling(self):
         """Obey policy where possible, ignore otherwise."""
-        if isinstance(self.branch_format, branch.BzrBranchFormat4):
+        if self.bzrdir_format.fixed_components:
             raise TestNotApplicable('Branch format 4 does not autoupgrade.')
         source = self.make_branch('source')
         stack_on = self.make_stacked_on_matching(source)

=== modified file 'bzrlib/tests/per_controldir/test_controldir.py'
--- a/bzrlib/tests/per_controldir/test_controldir.py	2011-02-19 19:19:30 +0000
+++ b/bzrlib/tests/per_controldir/test_controldir.py	2011-02-23 15:43:26 +0000
@@ -1014,8 +1014,7 @@
         if control is None:
             # uninitialisable format
             return
-        if not isinstance(control._format, (bzrdir.BzrDirFormat5,
-            bzrdir.BzrDirFormat6,)):
+        if not control._format.fixed_components:
             self.assertEqual(repo.bzrdir.root_transport.base,
                 made_repo.bzrdir.root_transport.base)
 
@@ -1083,8 +1082,7 @@
         if control is None:
             # uninitialisable format
             return
-        if isinstance(self.bzrdir_format, (bzrdir.BzrDirFormat5,
-            bzrdir.BzrDirFormat6)):
+        if self.bzrdir_format.fixed_components:
             # must stay with the all-in-one-format.
             repo_name = self.bzrdir_format.network_name()
         self.assertEqual(repo_name, repo._format.network_name())
@@ -1117,8 +1115,7 @@
             # set, so we skip a number of tests for RemoteBzrDirFormat's.
             self.assertIsInstance(control, RemoteBzrDir)
         else:
-            if need_meta and isinstance(expected_format, (bzrdir.BzrDirFormat5,
-                bzrdir.BzrDirFormat6)):
+            if need_meta and expected_format.fixed_components:
                 # Pre-metadir formats change when we are making something that
                 # needs a metaformat, because clone is used for push.
                 expected_format = bzrdir.BzrDirMetaFormat1()

=== modified file 'bzrlib/tests/per_repository/test_repository.py'
--- a/bzrlib/tests/per_repository/test_repository.py	2011-02-21 22:43:53 +0000
+++ b/bzrlib/tests/per_repository/test_repository.py	2011-02-23 15:43:26 +0000
@@ -929,7 +929,7 @@
             repo = self.make_repository('repo', shared=True)
         except errors.IncompatibleFormat:
             raise tests.TestNotApplicable('Cannot make a shared repository')
-        if isinstance(repo.bzrdir, bzrdir.BzrDirPreSplitOut):
+        if repo.bzrdir._format.fixed_components:
             raise tests.KnownFailure(
                 "pre metadir branches do not upgrade on push "
                 "with stacking policy")
@@ -1339,11 +1339,9 @@
             'rev1', _mod_revision.NULL_REVISION, fileobj)
 
 
-
-
 class TestRepositoryControlComponent(per_repository.TestCaseWithRepository):
     """Repository implementations adequately implement ControlComponent."""
-    
+
     def test_urls(self):
         repo = self.make_repository('repo')
         self.assertIsInstance(repo.user_url, str)

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-02-23 13:15:21 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-02-23 15:43:26 +0000
@@ -135,6 +135,10 @@
   ``import_last_revision_info_and_tags`` method instead.
   (Andrew Bennetts)
 
+* ``BzrDirFormat`` has a new attribute ``fixed_components`` that
+  indicates whether the components of the bzrdir can be upgraded
+  independent of the ``BzrDir``. (Jelmer Vernooij)
+
 * Repository formats should now be registered on the format registry
   (``bzrlib.repository.format_registry``) rather than using the class
   methods on ``RepositoryFormat``. (Jelmer Vernooij)




More information about the bazaar-commits mailing list