Rev 3174: Merge development format support. in http://people.ubuntu.com/~robertc/baz2.0/inventory.journalled

Robert Collins robertc at robertcollins.net
Sun Jan 6 20:08:45 GMT 2008


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

------------------------------------------------------------
revno: 3174
revision-id:robertc at robertcollins.net-20080106200839-4bmbk3dv23w1owi8
parent: robertc at robertcollins.net-20080104021002-71l0ihc8z2qx4eb1
parent: robertc at robertcollins.net-20080106200422-x8yz6cxotlzltvwp
committer: Robert Collins <robertc at robertcollins.net>
branch nick: inventory.journalled
timestamp: Mon 2008-01-07 07:08:39 +1100
message:
  Merge development format support.
added:
  doc/developers/development-repo.txt developmentrepo.txt-20080102200205-raj42k61dch8pjmj-1
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/info.py                 info.py-20050323235939-6bbfe7d9700b0b9b
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
  bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
    ------------------------------------------------------------
    revno: 3152.1.2
    revision-id:robertc at robertcollins.net-20080106200422-x8yz6cxotlzltvwp
    parent: robertc at robertcollins.net-20080102223046-h8nxufr1v21pnei2
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: experimental
    timestamp: Mon 2008-01-07 07:04:22 +1100
    message:
      The bzrdir format registry now accepts an ``alias`` keyword to
      register_metadir, used to indicate that a format name is an alias for
      some other format and thus should not be reported when describing the
      format. (Robert Collins)
      -------------- This line and the fmllowing will be ignored --------------
      
      modified:
        NEWS
        bzrlib/bzrdir.py
        bzrlib/info.py
        bzrlib/tests/test_bzrdir.py
        bzrlib/tests/test_info.py
      
      === modified file 'NEWS'
      --- a/NEWS	2008-01-02 22:30:46 +0000
      +++ b/NEWS	2008-01-06 20:04:15 +0000
      @@ -135,6 +135,11 @@
           * Patience Diff now supports arbitrary python objects, as long as they
             support ``hash()``. (John Arbash Meinel)
       
      +    * The bzrdir format registry now accepts an ``alias`` keyword to
      +      register_metadir, used to indicate that a format name is an alias for
      +      some other format and thus should not be reported when describing the
      +      format. (Robert Collins)
      +
         API BREAKS:
       
         TESTING:
      
      === modified file 'bzrlib/bzrdir.py'
      --- a/bzrlib/bzrdir.py	2008-01-02 22:30:46 +0000
      +++ b/bzrlib/bzrdir.py	2008-01-06 19:41:29 +0000
      @@ -2447,12 +2447,22 @@
           e.g. BzrDirMeta1 with weave repository.  Also, it's more user-oriented.
           """
       
      +    def __init__(self):
      +        """Create a BzrDirFormatRegistry."""
      +        self._aliases = set()
      +        super(BzrDirFormatRegistry, self).__init__()
      +
      +    def aliases(self):
      +        """Return a set of the format names which are aliases."""
      +        return frozenset(self._aliases)
      +
           def register_metadir(self, key,
                    repository_format, help, native=True, deprecated=False,
                    branch_format=None,
                    tree_format=None,
                    hidden=False,
      -             experimental=False):
      +             experimental=False,
      +             alias=False):
               """Register a metadir subformat.
       
               These all use a BzrDirMetaFormat1 bzrdir, but can be parameterized
      @@ -2491,10 +2501,10 @@
                       bd.repository_format = _load(repository_format)
                   return bd
               self.register(key, helper, help, native, deprecated, hidden,
      -            experimental)
      +            experimental, alias)
       
           def register(self, key, factory, help, native=True, deprecated=False,
      -                 hidden=False, experimental=False):
      +                 hidden=False, experimental=False, alias=False):
               """Register a BzrDirFormat factory.
               
               The factory must be a callable that takes one parameter: the key.
      @@ -2505,11 +2515,15 @@
               """
               registry.Registry.register(self, key, factory, help,
                   BzrDirFormatInfo(native, deprecated, hidden, experimental))
      +        if alias:
      +            self._aliases.add(key)
       
           def register_lazy(self, key, module_name, member_name, help, native=True,
      -                      deprecated=False, hidden=False, experimental=False):
      +        deprecated=False, hidden=False, experimental=False, alias=False):
               registry.Registry.register_lazy(self, key, module_name, member_name,
                   help, BzrDirFormatInfo(native, deprecated, hidden, experimental))
      +        if alias:
      +            self._aliases.add(key)
       
           def set_default(self, key):
               """Set the 'default' key to be a clone of the supplied key.
      @@ -2518,6 +2532,7 @@
               """
               registry.Registry.register(self, 'default', self.get(key),
                   self.get_help(key), info=self.get_info(key))
      +        self._aliases.add('default')
       
           def set_default_repository(self, key):
               """Set the FormatRegistry default and Repository default.
      @@ -2670,6 +2685,7 @@
           tree_format='bzrlib.workingtree.WorkingTreeFormat4',
           hidden=False,
           )
      +# The following two formats should always just be aliases.
       format_registry.register_metadir('development',
           'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0',
           help='Current development format. Can convert data to and from pack-0.92 '
      @@ -2681,6 +2697,7 @@
           branch_format='bzrlib.branch.BzrBranchFormat6',
           tree_format='bzrlib.workingtree.WorkingTreeFormat4',
           experimental=True,
      +    alias=True,
           )
       format_registry.register_metadir('development-subtree',
           'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0Subtree',
      @@ -2693,7 +2710,9 @@
           branch_format='bzrlib.branch.BzrBranchFormat6',
           tree_format='bzrlib.workingtree.WorkingTreeFormat4',
           experimental=True,
      +    alias=True,
           )
      +# And the development formats which the will have aliased one of follow:
       format_registry.register_metadir('development0',
           'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment0',
           help='Trivial rename of pack-0.92 to provide a development format. '
      
      === modified file 'bzrlib/info.py'
      --- a/bzrlib/info.py	2007-11-06 09:00:25 +0000
      +++ b/bzrlib/info.py	2008-01-06 20:01:30 +0000
      @@ -440,7 +440,9 @@
               tree.bzrdir.root_transport.base):
               branch = None
               repository = None
      -    for key in bzrdir.format_registry.keys():
      +    non_aliases = set(bzrdir.format_registry.keys())
      +    non_aliases.difference_update(bzrdir.format_registry.aliases())
      +    for key in non_aliases:
               format = bzrdir.format_registry.make_bzrdir(key)
               if isinstance(format, bzrdir.BzrDirMetaFormat1):
                   if (tree and format.workingtree_format !=
      @@ -457,11 +459,12 @@
               candidates.append(key)
           if len(candidates) == 0:
               return 'unnamed'
      -    new_candidates = [c for c in candidates if c != 'default']
      -    if len(new_candidates) > 0:
      -        candidates = new_candidates
      +    candidates.sort()
           new_candidates = [c for c in candidates if not
               bzrdir.format_registry.get_info(c).hidden]
           if len(new_candidates) > 0:
      +        # If there are any non-hidden formats that match, only return those to
      +        # avoid listing hidden formats except when only a hidden format will
      +        # do.
               candidates = new_candidates
           return ' or '.join(candidates)
      
      === modified file 'bzrlib/tests/test_bzrdir.py'
      --- a/bzrlib/tests/test_bzrdir.py	2007-12-21 20:32:22 +0000
      +++ b/bzrlib/tests/test_bzrdir.py	2008-01-06 19:45:00 +0000
      @@ -170,6 +170,16 @@
               finally:
                   bzrdir.format_registry.set_default_repository(old_default)
       
      +    def test_aliases(self):
      +        a_registry = bzrdir.BzrDirFormatRegistry()
      +        a_registry.register('weave', bzrdir.BzrDirFormat6,
      +            'Pre-0.8 format.  Slower and does not support checkouts or shared'
      +            ' repositories', deprecated=True)
      +        a_registry.register('weavealias', bzrdir.BzrDirFormat6,
      +            'Pre-0.8 format.  Slower and does not support checkouts or shared'
      +            ' repositories', deprecated=True, alias=True)
      +        self.assertEqual(frozenset(['weavealias']), a_registry.aliases())
      +    
       
       class SampleBranch(bzrlib.branch.Branch):
           """A dummy branch for guess what, dummy use."""
      
      === modified file 'bzrlib/tests/test_info.py'
      --- a/bzrlib/tests/test_info.py	2007-11-26 13:55:51 +0000
      +++ b/bzrlib/tests/test_info.py	2008-01-06 20:02:10 +0000
      @@ -126,16 +126,22 @@
       
           def test_describe_tree_format(self):
               for key in bzrdir.format_registry.keys():
      -            if key == 'default':
      +            if key in bzrdir.format_registry.aliases():
                       continue
                   self.assertTreeDescription(key)
       
           def test_describe_checkout_format(self):
               for key in bzrdir.format_registry.keys():
      -            if key in ('default', 'weave', 'experimental'):
      -                continue
      -            if key.startswith('experimental-'):
      -                # these are typically hidden or aliases for other formats
      +            if key in bzrdir.format_registry.aliases():
      +                # Aliases will not describe correctly in the UI because the
      +                # real format is found.
      +                continue
      +            # legacy: weave does not support checkouts
      +            if key == 'weave':
      +                continue
      +            if bzrdir.format_registry.get_info(key).experimental:
      +                # We don't require that experimental formats support checkouts
      +                # or describe correctly in the UI.
                       continue
                   expected = None
                   if key in ('dirstate', 'dirstate-tags', 'dirstate-with-subtree',
      @@ -149,7 +155,7 @@
       
           def test_describe_branch_format(self):
               for key in bzrdir.format_registry.keys():
      -            if key == 'default':
      +            if key in bzrdir.format_registry.aliases():
                       continue
                   expected = None
                   if key in ('dirstate', 'knit'):
      @@ -158,7 +164,7 @@
       
           def test_describe_repo_format(self):
               for key in bzrdir.format_registry.keys():
      -            if key == 'default':
      +            if key in bzrdir.format_registry.aliases():
                       continue
                   expected = None
                   if key in ('dirstate', 'knit', 'dirstate-tags'):
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/info.py                 info.py-20050323235939-6bbfe7d9700b0b9b
      bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
      bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
    ------------------------------------------------------------
    revno: 3152.1.1
    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-06 20:04:22 +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``.
@@ -129,6 +135,11 @@
     * Patience Diff now supports arbitrary python objects, as long as they
       support ``hash()``. (John Arbash Meinel)
 
+    * The bzrdir format registry now accepts an ``alias`` keyword to
+      register_metadir, used to indicate that a format name is an alias for
+      some other format and thus should not be reported when describing the
+      format. (Robert Collins)
+
   API BREAKS:
 
   TESTING:

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2007-12-22 00:03:14 +0000
+++ b/bzrlib/bzrdir.py	2008-01-06 20:04:22 +0000
@@ -2447,12 +2447,22 @@
     e.g. BzrDirMeta1 with weave repository.  Also, it's more user-oriented.
     """
 
+    def __init__(self):
+        """Create a BzrDirFormatRegistry."""
+        self._aliases = set()
+        super(BzrDirFormatRegistry, self).__init__()
+
+    def aliases(self):
+        """Return a set of the format names which are aliases."""
+        return frozenset(self._aliases)
+
     def register_metadir(self, key,
              repository_format, help, native=True, deprecated=False,
              branch_format=None,
              tree_format=None,
              hidden=False,
-             experimental=False):
+             experimental=False,
+             alias=False):
         """Register a metadir subformat.
 
         These all use a BzrDirMetaFormat1 bzrdir, but can be parameterized
@@ -2491,10 +2501,10 @@
                 bd.repository_format = _load(repository_format)
             return bd
         self.register(key, helper, help, native, deprecated, hidden,
-            experimental)
+            experimental, alias)
 
     def register(self, key, factory, help, native=True, deprecated=False,
-                 hidden=False, experimental=False):
+                 hidden=False, experimental=False, alias=False):
         """Register a BzrDirFormat factory.
         
         The factory must be a callable that takes one parameter: the key.
@@ -2503,21 +2513,26 @@
         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))
+        if alias:
+            self._aliases.add(key)
 
     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, 
+        deprecated=False, hidden=False, experimental=False, alias=False):
+        registry.Registry.register_lazy(self, key, module_name, member_name,
             help, BzrDirFormatInfo(native, deprecated, hidden, experimental))
+        if alias:
+            self._aliases.add(key)
 
     def set_default(self, key):
         """Set the 'default' key to be a clone of the supplied key.
         
         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))
+        self._aliases.add('default')
 
     def set_default_repository(self, key):
         """Set the FormatRegistry default and Repository default.
@@ -2660,7 +2675,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 +2684,55 @@
     branch_format='bzrlib.branch.BzrBranchFormat6',
     tree_format='bzrlib.workingtree.WorkingTreeFormat4',
     hidden=False,
+    )
+# The following two formats should always just be aliases.
+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,
+    alias=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,
+    alias=True,
+    )
+# And the development formats which the will have aliased one of follow:
+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/info.py'
--- a/bzrlib/info.py	2007-11-06 09:00:25 +0000
+++ b/bzrlib/info.py	2008-01-06 20:04:22 +0000
@@ -440,7 +440,9 @@
         tree.bzrdir.root_transport.base):
         branch = None
         repository = None
-    for key in bzrdir.format_registry.keys():
+    non_aliases = set(bzrdir.format_registry.keys())
+    non_aliases.difference_update(bzrdir.format_registry.aliases())
+    for key in non_aliases:
         format = bzrdir.format_registry.make_bzrdir(key)
         if isinstance(format, bzrdir.BzrDirMetaFormat1):
             if (tree and format.workingtree_format !=
@@ -457,11 +459,12 @@
         candidates.append(key)
     if len(candidates) == 0:
         return 'unnamed'
-    new_candidates = [c for c in candidates if c != 'default']
-    if len(new_candidates) > 0:
-        candidates = new_candidates
+    candidates.sort()
     new_candidates = [c for c in candidates if not
         bzrdir.format_registry.get_info(c).hidden]
     if len(new_candidates) > 0:
+        # If there are any non-hidden formats that match, only return those to
+        # avoid listing hidden formats except when only a hidden format will
+        # do.
         candidates = new_candidates
     return ' or '.join(candidates)

=== 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_bzrdir.py'
--- a/bzrlib/tests/test_bzrdir.py	2007-12-21 20:32:22 +0000
+++ b/bzrlib/tests/test_bzrdir.py	2008-01-06 20:04:22 +0000
@@ -170,6 +170,16 @@
         finally:
             bzrdir.format_registry.set_default_repository(old_default)
 
+    def test_aliases(self):
+        a_registry = bzrdir.BzrDirFormatRegistry()
+        a_registry.register('weave', bzrdir.BzrDirFormat6,
+            'Pre-0.8 format.  Slower and does not support checkouts or shared'
+            ' repositories', deprecated=True)
+        a_registry.register('weavealias', bzrdir.BzrDirFormat6,
+            'Pre-0.8 format.  Slower and does not support checkouts or shared'
+            ' repositories', deprecated=True, alias=True)
+        self.assertEqual(frozenset(['weavealias']), a_registry.aliases())
+    
 
 class SampleBranch(bzrlib.branch.Branch):
     """A dummy branch for guess what, dummy use."""

=== modified file 'bzrlib/tests/test_info.py'
--- a/bzrlib/tests/test_info.py	2007-11-26 13:55:51 +0000
+++ b/bzrlib/tests/test_info.py	2008-01-06 20:04:22 +0000
@@ -126,16 +126,22 @@
 
     def test_describe_tree_format(self):
         for key in bzrdir.format_registry.keys():
-            if key == 'default':
+            if key in bzrdir.format_registry.aliases():
                 continue
             self.assertTreeDescription(key)
 
     def test_describe_checkout_format(self):
         for key in bzrdir.format_registry.keys():
-            if key in ('default', 'weave', 'experimental'):
-                continue
-            if key.startswith('experimental-'):
-                # these are typically hidden or aliases for other formats
+            if key in bzrdir.format_registry.aliases():
+                # Aliases will not describe correctly in the UI because the
+                # real format is found.
+                continue
+            # legacy: weave does not support checkouts
+            if key == 'weave':
+                continue
+            if bzrdir.format_registry.get_info(key).experimental:
+                # We don't require that experimental formats support checkouts
+                # or describe correctly in the UI.
                 continue
             expected = None
             if key in ('dirstate', 'dirstate-tags', 'dirstate-with-subtree',
@@ -149,7 +155,7 @@
 
     def test_describe_branch_format(self):
         for key in bzrdir.format_registry.keys():
-            if key == 'default':
+            if key in bzrdir.format_registry.aliases():
                 continue
             expected = None
             if key in ('dirstate', 'knit'):
@@ -158,7 +164,7 @@
 
     def test_describe_repo_format(self):
         for key in bzrdir.format_registry.keys():
-            if key == 'default':
+            if key in bzrdir.format_registry.aliases():
                 continue
             expected = None
             if key in ('dirstate', 'knit', 'dirstate-tags'):

=== 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