Looking at the code, all of the registries at least have the concept of a default. Most code paths just use the default metadir.
Robert fixed this for repositories by making the definition a bit circular:
RepositoryFormat:
@classmethod
def get_default_format(klass):
"""Return the current default format."""
from bzrlib import bzrdir
return bzrdir.format_registry.make_bzrdir('default').repository_format
And
BzrDirMetaFormat1:
def __return_repository_format(self):
"""Circular import protection."""
if getattr(self, '_repository_format', None):
return self._repository_format
from bzrlib.repository import RepositoryFormat
return RepositoryFormat.get_default_format()
def __set_repository_format(self, value):
"""Allow changing the repository format for metadir formats.""" self._repository_format = value
There is also
BzrDirFormatRegistry:
def set_default_repository(self, key):
"""Set the FormatRegistry default and Repository default.
This is a transitional method while Repository.set_default_format
is deprecated.
"""
if 'default' in self: self.remove('default') self.set_default(key)
format = self.get('default')()
^- This is a bit confusing to me, since 'key' here should be talking about a repository (by the function name) but would have to be describing a bzrdir format, since it is setting self.set_default(key). Also, is the last line just to ensure that the format was properly registered?
Looking at the code, all of the registries at least have the concept of a default. Most code paths just use the default metadir.
Robert fixed this for repositories by making the definition a bit circular: format( klass): format_ registry. make_bzrdir( 'default' ).repository_ format
RepositoryFormat:
@classmethod
def get_default_
"""Return the current default format."""
from bzrlib import bzrdir
return bzrdir.
And repository_ format( self): format' , None): y_format t.get_default_ format( )
BzrDirMetaFormat1:
def __return_
"""Circular import protection."""
if getattr(self, '_repository_
return self._repositor
from bzrlib.repository import RepositoryFormat
return RepositoryForma
def __set_repositor y_format( self, value):
self._ repository_ format = value
"""Allow changing the repository format for metadir formats."""
repository_ format = property( __return_ repository_ format, __set_repositor y_format)
There is also istry: repository( self, key):
BzrDirFormatReg
def set_default_
"""Set the FormatRegistry default and Repository default.
This is a transitional method while Repository. set_default_ format
self. remove( 'default' )
self.set_ default( key) 'default' )()
is deprecated.
"""
if 'default' in self:
format = self.get(
^- This is a bit confusing to me, since 'key' here should be talking about a repository (by the function name) but would have to be describing a bzrdir format, since it is setting self.set_ default( key). Also, is the last line just to ensure that the format was properly registered?