Rev 3153: * A new repository format 'development' has been added. This format will in http://people.ubuntu.com/~robertc/baz2.0/experimental

Robert Collins robertc at robertcollins.net
Wed Jan 2 22:32:06 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/experimental

------------------------------------------------------------
revno: 3153
revision-id:robertc at robertcollins.net-20080102223046-h8nxufr1v21pnei2
parent: pqm at pqm.ubuntu.com-20080102154906-hqiq6x2eammznjtg
committer: Robert Collins <robertc at robertcollins.net>
branch nick: experimental
timestamp: Thu 2008-01-03 09:30:46 +1100
message:
  * A new repository format 'development' has been added. This format will
    represent the latest 'in-progress' format that the bzr developers are
    interested in getting early-adopter testing and feedback on.
    ``doc/developers/development-repo.txt`` has detailed information.
    (Robert Collins)
added:
  doc/developers/development-repo.txt developmentrepo.txt-20080102200205-raj42k61dch8pjmj-1
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
=== modified file 'NEWS'
--- a/NEWS	2008-01-02 15:49:06 +0000
+++ b/NEWS	2008-01-02 22:30:46 +0000
@@ -14,6 +14,12 @@
      been made to remove the ambiguity where ``branch2`` is in fact a
      specific file to diff within ``branch1``.
 
+   * A new repository format 'development' has been added. This format will
+     represent the latest 'in-progress' format that the bzr developers are
+     interested in getting early-adopter testing and feedback on.
+     ``doc/developers/development-repo.txt`` has detailed information.
+     (Robert Collins)
+
   FEATURES:
 
    * New option to use custom template-based formats in  ``bzr version-info``.

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2007-12-22 00:03:14 +0000
+++ b/bzrlib/bzrdir.py	2008-01-02 22:30:46 +0000
@@ -2503,12 +2503,12 @@
         This function mainly exists to prevent the info object from being
         supplied directly.
         """
-        registry.Registry.register(self, key, factory, help, 
+        registry.Registry.register(self, key, factory, help,
             BzrDirFormatInfo(native, deprecated, hidden, experimental))
 
     def register_lazy(self, key, module_name, member_name, help, native=True,
                       deprecated=False, hidden=False, experimental=False):
-        registry.Registry.register_lazy(self, key, module_name, member_name, 
+        registry.Registry.register_lazy(self, key, module_name, member_name,
             help, BzrDirFormatInfo(native, deprecated, hidden, experimental))
 
     def set_default(self, key):
@@ -2516,7 +2516,7 @@
         
         This method must be called once and only once.
         """
-        registry.Registry.register(self, 'default', self.get(key), 
+        registry.Registry.register(self, 'default', self.get(key),
             self.get_help(key), info=self.get_info(key))
 
     def set_default_repository(self, key):
@@ -2660,7 +2660,6 @@
     branch_format='bzrlib.branch.BzrBranchFormat6',
     tree_format='bzrlib.workingtree.WorkingTreeFormat4',
     hidden=True,
-    experimental=True,
     )
 format_registry.register_metadir('rich-root-pack',
     'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack4',
@@ -2670,6 +2669,51 @@
     branch_format='bzrlib.branch.BzrBranchFormat6',
     tree_format='bzrlib.workingtree.WorkingTreeFormat4',
     hidden=False,
+    )
+format_registry.register_metadir('development',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0',
+    help='Current development format. Can convert data to and from pack-0.92 '
+        '(and anything compatible with pack-0.92) format repositories. '
+        'Repositories in this format can only be read by bzr.dev. '
+        'Please read '
+        'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
+        'before use.',
+    branch_format='bzrlib.branch.BzrBranchFormat6',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    experimental=True,
+    )
+format_registry.register_metadir('development-subtree',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0Subtree',
+    help='Current development format, subtree variant. Can convert data to and '
+        'from pack-0.92 (and anything compatible with pack-0.92) format '
+        'repositories. Repositories in this format can only be read by '
+        'bzr.dev. Please read '
+        'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
+        'before use.',
+    branch_format='bzrlib.branch.BzrBranchFormat6',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    experimental=True,
+    )
+format_registry.register_metadir('development0',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0',
+    help='Trivial rename of pack-0.92 to provide a development format. '
+        'Please read '
+        'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
+        'before use.',
+    branch_format='bzrlib.branch.BzrBranchFormat6',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    hidden=True,
+    experimental=True,
+    )
+format_registry.register_metadir('development0-subtree',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0Subtree',
+    help='Trivial rename of pack-0.92-subtree to provide a development format. '
+        'Please read '
+        'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
+        'before use.',
+    branch_format='bzrlib.branch.BzrBranchFormat6',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    hidden=True,
     experimental=True,
     )
 format_registry.set_default('pack-0.92')

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2008-01-02 05:32:20 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2008-01-02 22:30:46 +0000
@@ -2237,3 +2237,80 @@
     def get_format_description(self):
         """See RepositoryFormat.get_format_description()."""
         return "Packs containing knits with rich root support\n"
+
+
+class RepositoryFormatPackDevelopment0(RepositoryFormatPack):
+    """A no-subtrees development repository.
+
+    This format should be retained until the second release after bzr 1.0.
+
+    No changes to the disk behaviour from pack-0.92.
+    """
+
+    repository_class = KnitPackRepository
+    _commit_builder_class = PackCommitBuilder
+    _serializer = xml5.serializer_v5
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir('development0')
+
+    def _ignore_setting_bzrdir(self, format):
+        pass
+
+    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
+
+    def get_format_string(self):
+        """See RepositoryFormat.get_format_string()."""
+        return "Bazaar development format 0 (needs bzr.dev from before 1.1)\n"
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return ("Development repository format, currently the same as "
+            "pack-0.92\n")
+
+    def check_conversion_target(self, target_format):
+        pass
+
+
+class RepositoryFormatPackDevelopment0Subtree(RepositoryFormatPack):
+    """A subtrees development repository.
+
+    This format should be retained until the second release after bzr 1.0.
+
+    No changes to the disk behaviour from pack-0.92-subtree.
+    """
+
+    repository_class = KnitPackRepository
+    _commit_builder_class = PackRootCommitBuilder
+    rich_root_data = True
+    supports_tree_reference = True
+    _serializer = xml7.serializer_v7
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir(
+            'development0-subtree')
+
+    def _ignore_setting_bzrdir(self, format):
+        pass
+
+    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
+
+    def check_conversion_target(self, target_format):
+        if not target_format.rich_root_data:
+            raise errors.BadConversionTarget(
+                'Does not support rich root data.', target_format)
+        if not getattr(target_format, 'supports_tree_reference', False):
+            raise errors.BadConversionTarget(
+                'Does not support nested trees', target_format)
+            
+    def get_format_string(self):
+        """See RepositoryFormat.get_format_string()."""
+        return ("Bazaar development format 0 with subtree support "
+            "(needs bzr.dev from before 1.1)\n")
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return ("Development repository format, currently the same as "
+            "pack-0.92-subtree\n")
+
+

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-01-02 15:49:06 +0000
+++ b/bzrlib/repository.py	2008-01-02 22:30:46 +0000
@@ -2223,7 +2223,7 @@
 
 # Pack-based formats. There is one format for pre-subtrees, and one for
 # post-subtrees to allow ease of testing.
-# NOTE: These are experimental in 0.92.
+# NOTE: These are experimental in 0.92. Stable in 1.0 and above
 format_registry.register_lazy(
     'Bazaar pack repository format 1 (needs bzr 0.92)\n',
     'bzrlib.repofmt.pack_repo',
@@ -2239,6 +2239,21 @@
     'bzrlib.repofmt.pack_repo',
     'RepositoryFormatKnitPack4',
     )
+# Development formats. 
+# 1.0->1.1
+# development 0 - stub to introduce development versioning scheme.
+format_registry.register_lazy(
+    "Bazaar development format 0 (needs bzr.dev from before 1.1)\n",
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment0',
+    )
+format_registry.register_lazy(
+    ("Bazaar development format 0 with subtree support "
+        "(needs bzr.dev from before 1.1)\n"),
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment0Subtree',
+    )
+# 1.1->1.2 go below here
 
 
 class InterRepository(InterObject):
@@ -2720,13 +2735,24 @@
         try:
             from bzrlib.repofmt.knitrepo import (RepositoryFormatKnit1,
                 RepositoryFormatKnit3)
-            from bzrlib.repofmt.pack_repo import (RepositoryFormatKnitPack1,
-                RepositoryFormatKnitPack3)
-            return (isinstance(source._format,
-                    (RepositoryFormatKnit1, RepositoryFormatKnitPack1)) and
-                isinstance(target._format,
-                    (RepositoryFormatKnit3, RepositoryFormatKnitPack3))
-                )
+            from bzrlib.repofmt.pack_repo import (
+                RepositoryFormatKnitPack1,
+                RepositoryFormatKnitPack3,
+                RepositoryFormatPackDevelopment0,
+                RepositoryFormatPackDevelopment0Subtree,
+                )
+            nosubtrees = (
+                RepositoryFormatKnit1,
+                RepositoryFormatKnitPack1,
+                RepositoryFormatPackDevelopment0,
+                )
+            subtrees = (
+                RepositoryFormatKnit3,
+                RepositoryFormatKnitPack3,
+                RepositoryFormatPackDevelopment0Subtree,
+                )
+            return (isinstance(source._format, nosubtrees) and
+                isinstance(target._format, subtrees))
         except AttributeError:
             return False
 

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2007-12-04 02:19:39 +0000
+++ b/bzrlib/tests/test_repository.py	2008-01-02 22:30:46 +0000
@@ -1178,6 +1178,31 @@
             t.get('format').read())
 
 
+class TestDevelopment0(TestKnitPackNoSubtrees):
+
+    def get_format(self):
+        return bzrdir.format_registry.make_bzrdir(
+            'development')
+
+    def check_format(self, t):
+        self.assertEqualDiff(
+            "Bazaar development format 0 (needs bzr.dev from before 1.1)\n",
+            t.get('format').read())
+
+
+class TestDevelopment0Subtree(TestKnitPackNoSubtrees):
+
+    def get_format(self):
+        return bzrdir.format_registry.make_bzrdir(
+            'development-subtree')
+
+    def check_format(self, t):
+        self.assertEqualDiff(
+            "Bazaar development format 0 with subtree support "
+            "(needs bzr.dev from before 1.1)\n",
+            t.get('format').read())
+
+
 class TestRepositoryPackCollection(TestCaseWithTransport):
 
     def get_format(self):

=== added file 'doc/developers/development-repo.txt'
--- a/doc/developers/development-repo.txt	1970-01-01 00:00:00 +0000
+++ b/doc/developers/development-repo.txt	2008-01-02 22:30:46 +0000
@@ -0,0 +1,246 @@
+==============================
+Development repository formats
+==============================
+
+.. contents::
+
+Using development repository formats
+====================================
+
+Motivation
+----------
+
+We believe that we can continue to gain substantial performance benefits
+by altering the repository storage in bzr. The more feedback we can get
+on the changes during the development process the better.
+
+To make it possible to get more feedback we are going to expose the
+current development formats to the users of our development trunk
+'bzr.dev'. The technical details of the individual formats are at the
+end of this document.
+
+Format names
+------------
+
+The current development format will be called 'development'. Each time
+the development format changes, the prior development format will be
+renamed to e.g. 'development0', 'development1' etc.
+
+When a release of bzr is done, all the older numbered development
+formats will be removed from 'bzr.dev', so we will not be carrying the
+code for them around indefinately. 
+
+Support for upgrade and migration
+---------------------------------
+
+The preservation and renaming policy makes it quite safe for users to
+test out development formats (though we cannot guarantee bugs of course
+- it is development code):
+
+ - users of a given development format can always get back onto regular
+   formats by switching to the next bzr released version which is
+   guaranteed to be able to upgrade from that development format.
+ - users that routinely use bzr.dev should upgrade to the most recent 
+   development version available before pulling in bzr.dev changes
+   around release time, as that is when old format cleanups will occur.
+
+We cannot guarantee backwards compatability though, because some of the
+planned work may be 'upgrade only'. Please see ``bzr help formats`` for
+the text of the 'development' format which will indicate its
+compatability with other formats if you need to interoperate with
+users or services that do not have bzr.dev.
+
+Before converting to a development format
+-----------------------------------------
+
+Run a ``bzr check`` with the version of bzr that you will be using.
+``bzr check`` gets updated as we find new things that are inconsistent
+with existing repositories. While only a small number of repositories
+are likely to have any given error, it is best to check just in case.
+
+If ``bzr check`` reports a problem, run this command::
+
+  bzr reconcile
+
+Note that reconcile can take many hours, particularly if you are
+reconciling one of the 'knit' or 'dirstate' format repositories. If you
+have such a repository, consider upgrading it to 'pack-0.92' first,
+which will perform reconcile significantly faster.
+
+Creating a new development format branch
+----------------------------------------
+
+If you're starting a project from scratch, it's easy to make it a
+``development`` one. Here's how::
+
+  cd my-stuff
+  bzr init --development
+  bzr add
+  bzr commit -m "initial import"
+
+In other words, use the normal sequence of commands but add the
+``--development`` option to the ``init`` command.
+
+
+Creating a new development format repository
+--------------------------------------------
+
+If you're starting a project from scratch and wish to use a shared repository
+for branches, you can make it a ``development`` repository like this::
+
+  cd my-repo
+  bzr init-repo --development .
+  cd my-stuff
+  bzr init
+  bzr add
+  bzr commit -m "initial import"
+
+In other words, use the normal sequence of commands but add the
+``--development`` option to the ``init-repo`` command.
+
+Upgrading an existing branch or repository to development
+---------------------------------------------------------
+
+If you have an existing branch and wish to migrate it to
+a ``development`` format, use the ``upgrade`` command like this::
+
+  bzr upgrade --development path-to-my-branch
+
+If you are using a shared repository, run::
+
+  bzr upgrade --development ROOT_OF_REPOSITORY
+
+to upgrade the history database. Note that this will not
+alter the branch format of each branch, so
+you will need to also upgrade each branch individually
+if you are upgrading from an old (e.g. < 0.17) bzr.
+More modern bzr's will already have the branch format at
+our latest branch format which adds support for tags.
+
+Starting a new development format branch from one in an older format
+--------------------------------------------------------------------
+
+This can be done in one of several ways:
+
+1. Create a new branch and pull into it
+2. Create a standalone branch and upgrade its format
+3. Create a knitpack shared repository and branch into it
+
+Here are the commands for using the ``pull`` approach::
+
+    bzr init --development my-new-branch
+    cd my-new-branch
+    bzr pull my-source-branch
+
+Here are the commands for using the ``upgrade`` approach::
+
+    bzr branch my-source-branch my-new-branch
+    cd my-new-branch
+    bzr upgrade --development .
+
+Here are the commands for the shared repository approach::
+
+  cd my-repo
+  bzr init-repo --development .
+  bzr branch my-source-branch my-new-branch
+  cd my-new-branch
+
+As a reminder, any of the above approaches can fail if the source branch
+has inconsistent data within it and hasn't been reconciled yet. Please
+be sure to check that before reporting problems.
+
+Develoment formats for bzr-svn users
+------------------------------------
+
+If you are using ``bzr-svn`` or are testing the prototype subtree support,
+you can still use and assist in testing the development formats. The
+commands to use are identical to the ones given above except that the
+name of the format to use is ``development-subtree``.
+
+**WARNING**: Note that bzr only supports one-way conversion **to** the
+subtree format ``development-subtree``. Once you are using
+``development-subtree`` you cannot pull or merge back into a regular
+format such as ``pack-0.92``, ``development`` etc.
+
+The ``development-subtree`` format is required for the bzr-svn
+plug-in but should otherwise not be used until the subtree feature is
+complete within bzr.
+
+Reporting problems
+------------------
+
+If you need any help or encounter any problems, please contact the developers
+via the usual ways, i.e. chat to us on IRC or send a message to our mailing
+list. See http://bazaar-vcs.org/BzrSupport for contact details.
+
+
+Technical notes
+===============
+
+When to create a new development format
+---------------------------------------
+
+Whenever a code change will result in incorrect behaviour with existing
+``development`` repositories. Changes in push/pull/init/commit/merge
+have all been known to do this in the past.
+
+How to create a new development format
+--------------------------------------
+
+1. Register two new formats with the next available sequence number.
+   e.g. ``development1`` and ``development1-subtree``. (You can see the
+   ``development0`` format for an example.
+   These should:
+
+   * Use your new development repository/branch/tree classes
+   * Have really bare bones help - something like 'changes X to be Y
+     see ...developers/development-repo.html'
+   * Be hidden and experimental.
+2. Change the repository class (or branch or tree) in the
+   ``development`` and ``development-subtree`` formats to point to the
+   new class you are creating.
+3. Add a new development format (and tests!). Repository formats are in
+   ``bzrlib.repofmt``. You probably want to reproduce the current
+   development format from ``bzrlib.repofmt.pack_repo`` with just new
+   disk format strings, ``_get_matching_bzrdir`` and help.
+4. Alter any other things that do class based tests. The easiest way
+   to find these is a grep for Development in bzrlib - and please
+   refactor as you find these to reduce the relevance this step has,
+   as it should not need to exist.
+5. Now subclass/create from scratch/whatever the live object code you
+   need to change to introduce your new format. Keep in mind that
+   eventually it will become the default format, so please don't keep
+   subclassing the last releases code, rather consider making the last
+   releases code a subclass of your new code (if there is a lot in
+   common) so that we can eventually remove that format once it becomes
+   ancient (or relegate it to a plugin).
+6. Once you have made the changes that required a new disk format, you
+   should submit the resulting branch to be merged. Other changes - to
+   take advantage of whatever new feature you have added - should be
+   sent in separately, because the disk level changes are a contention
+   point between multiple developers.
+
+Format Details
+==============
+
+development
+-----------
+
+Currently an alias for Development0
+
+development-subtree
+-------------------
+
+Currently an alias for Development0Subtree
+
+Development0[Subtree]
+---------------------
+
+These formats exists solely to provide an actual new format for the
+feature of 'development formats' to be introduced. They are regular
+pack-0.92 style formats with no changes to the disk storage other than
+the version marker.
+
+
+..
+   vim: tw=72 ft=rst expandtab



More information about the bazaar-commits mailing list