~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Aaron Bentley
  • Date: 2006-12-21 04:34:42 UTC
  • mto: (2255.1.1 bzr.ab.integration)
  • mto: This revision was merged to the branch mainline in revision 2220.
  • Revision ID: aaron.bentley@utoronto.ca-20061221043442-x3mv0kxnsu7c2z5j
restore register_lazy, remove register_factory, other updates

Show diffs side-by-side

added added

removed removed

Lines of Context:
1966
1966
        """
1967
1967
        # This should be expanded to support setting WorkingTree and Branch
1968
1968
        # formats, once BzrDirMetaFormat1 supports that.
1969
 
        def helper(key):
 
1969
        def helper():
1970
1970
            import bzrlib.repository
1971
1971
            repo_format = getattr(bzrlib.repository, repo)
1972
1972
            bd = BzrDirMetaFormat1()
1974
1974
            return bd
1975
1975
        self.register(key, helper, help, native, deprecated)
1976
1976
 
1977
 
    def register_factory(self, key, factory, help, native=True, 
1978
 
                         deprecated=False):
1979
 
        """Register a BzrDirFormat factory.
1980
 
 
1981
 
        The factory must be a callable (usually a class), and produce an
1982
 
        instance of the BzrDirFormat when called.
1983
 
        """
1984
 
        self.register(key, lambda x: factory(), help, native, deprecated)
1985
 
 
1986
1977
    def register(self, key, factory, help, native=True, deprecated=False):
1987
1978
        """Register a BzrDirFormat factory.
1988
1979
        
1995
1986
        registry.Registry.register(self, key, factory, help, 
1996
1987
            BzrDirFormatInfo(native, deprecated))
1997
1988
 
1998
 
    def register_lazy(self):
1999
 
        # prevent use of Registry.register_lazy
2000
 
        # lazy-loading can be done by registering a suitable factory.
2001
 
        raise NotImplementedError(self.register_lazy)
 
1989
    def register_lazy(self, key, module_name, member_name, help, native=True,
 
1990
                      deprecated=False):
 
1991
        registry.Registry.register_lazy(self, key, module_name, member_name, 
 
1992
            help, BzrDirFormatInfo(native, deprecated))
2002
1993
 
2003
1994
    def set_default(self, key):
2004
1995
        """Set the 'default' key to be a clone of the supplied key.
2009
2000
            self.get_help(key), info=self.get_info(key))
2010
2001
 
2011
2002
    def make_bzrdir(self, key):
2012
 
        return self.get(key)(key)
 
2003
        return self.get(key)()
2013
2004
 
2014
2005
    def help_topic(self, topic):
2015
2006
        output = textwrap.dedent("""\
2056
2047
 
2057
2048
 
2058
2049
format_registry = BzrDirFormatRegistry()
2059
 
format_registry.register_factory('weave', BzrDirFormat6,
 
2050
format_registry.register('weave', BzrDirFormat6,
2060
2051
    'Pre-0.8 format.  Slower than knit and does not'
2061
2052
    ' support checkouts or shared repositories.', deprecated=True)
2062
2053
format_registry.register_metadir('knit', 'RepositoryFormatKnit1',