there should be just one setting for default format

Bug #132376 reported by Martin Pool
2
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned
Breezy
Triaged
Low
Unassigned

Bug Description

At the moment BranchFormat (and Repository and WorkingTree, I think) have a concept of a default format, and there is also a default BzrDirFormat which implicitly sets them. If they are not in sync, wierd things may happen, at least in the test case. It might be better to have just one place where the default is set.

See also bug 90302.

Martin Pool (mbp)
Changed in bzr:
importance: Undecided → Wishlist
Revision history for this message
Robert Collins (lifeless) wrote :

fixed for repositories in bzr.dev

Revision history for this message
John A Meinel (jameinel) wrote :

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

    repository_format = property(__return_repository_format, __set_repository_format)

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?

Changed in bzr:
status: New → Triaged
Martin Pool (mbp)
Changed in bzr:
importance: Wishlist → Medium
Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
Jelmer Vernooij (jelmer)
tags: added: format-infrastructure formats formatsui
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
Changed in brz:
status: New → Triaged
importance: Undecided → Medium
importance: Medium → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.