1
# Copyright (C) 2005, 2006 Canonical Ltd
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
874
873
def open_repository(self):
875
874
"""See BzrDir.open_repository."""
876
from bzrlib.repository import RepositoryFormat4
875
from bzrlib.repofmt.weaverepo import RepositoryFormat4
877
876
return RepositoryFormat4().open(self, _found=True)
886
885
def open_repository(self):
887
886
"""See BzrDir.open_repository."""
888
from bzrlib.repository import RepositoryFormat5
887
from bzrlib.repofmt.weaverepo import RepositoryFormat5
889
888
return RepositoryFormat5().open(self, _found=True)
891
890
def open_workingtree(self, _unsupported=False):
903
902
def open_repository(self):
904
903
"""See BzrDir.open_repository."""
905
from bzrlib.repository import RepositoryFormat6
904
from bzrlib.repofmt.weaverepo import RepositoryFormat6
906
905
return RepositoryFormat6().open(self, _found=True)
908
907
def open_workingtree(self, _unsupported=False):
1304
1303
def __return_repository_format(self):
1305
1304
"""Circular import protection."""
1306
from bzrlib.repository import RepositoryFormat4
1305
from bzrlib.repofmt.weaverepo import RepositoryFormat4
1307
1306
return RepositoryFormat4()
1308
1307
repository_format = property(__return_repository_format)
1343
1342
Except when they are being cloned.
1345
1344
from bzrlib.branch import BzrBranchFormat4
1346
from bzrlib.repository import RepositoryFormat5
1345
from bzrlib.repofmt.weaverepo import RepositoryFormat5
1347
1346
from bzrlib.workingtree import WorkingTreeFormat2
1348
1347
result = (super(BzrDirFormat5, self).initialize_on_transport(transport))
1349
1348
RepositoryFormat5().initialize(result, _internal=True)
1364
1363
def __return_repository_format(self):
1365
1364
"""Circular import protection."""
1366
from bzrlib.repository import RepositoryFormat5
1365
from bzrlib.repofmt.weaverepo import RepositoryFormat5
1367
1366
return RepositoryFormat5()
1368
1367
repository_format = property(__return_repository_format)
1402
1401
Except when they are being cloned.
1404
1403
from bzrlib.branch import BzrBranchFormat4
1405
from bzrlib.repository import RepositoryFormat6
1404
from bzrlib.repofmt.weaverepo import RepositoryFormat6
1406
1405
from bzrlib.workingtree import WorkingTreeFormat2
1407
1406
result = super(BzrDirFormat6, self).initialize_on_transport(transport)
1408
1407
RepositoryFormat6().initialize(result, _internal=True)
1423
1422
def __return_repository_format(self):
1424
1423
"""Circular import protection."""
1425
from bzrlib.repository import RepositoryFormat6
1424
from bzrlib.repofmt.weaverepo import RepositoryFormat6
1426
1425
return RepositoryFormat6()
1427
1426
repository_format = property(__return_repository_format)
1835
1834
def convert(self, to_convert, pb):
1836
1835
"""See Converter.convert()."""
1836
from bzrlib.repofmt.weaverepo import RepositoryFormat7_instance
1837
1837
from bzrlib.branch import BzrBranchFormat5
1838
1838
self.bzrdir = to_convert
1869
1869
# we hard code the formats here because we are converting into
1870
1870
# the meta format. The meta format upgrader can take this to a
1871
1871
# future format within each component.
1872
self.put_format('repository', _mod_repository.RepositoryFormat7())
1872
self.put_format('repository', RepositoryFormat7_instance)
1873
1873
for entry in repository_names:
1874
1874
self.move_entry('repository', entry)
1987
1987
e.g. BzrDirMeta1 with weave repository. Also, it's more user-oriented.
1990
def register_metadir(self, key, repo, help, native=True, deprecated=False):
1990
def register_metadir(self, key, repo, help, native=True, deprecated=False,
1991
repo_module='bzrlib.repository'):
1991
1992
"""Register a metadir subformat.
1993
repo is the repository format name as a string.
1994
These all use a BzrDirMetaFormat1 bzrdir, but can be parameterized
1995
by the Repository format.
1997
:param repo: The repository format class name as a string.
1999
:param repo_module: The module from which the repository class
2000
should be lazily loaded. By default this is bzrlib.repository.
1995
2002
# This should be expanded to support setting WorkingTree and Branch
1996
2003
# formats, once BzrDirMetaFormat1 supports that.
1998
import bzrlib.repository
1999
repo_format = getattr(bzrlib.repository, repo)
2005
mod = __import__(repo_module, globals(), locals(), [repo])
2007
repo_format_class = getattr(mod, repo)
2008
except AttributeError:
2009
raise AttributeError('no repository format %r in module %r'
2000
2011
bd = BzrDirMetaFormat1()
2001
bd.repository_format = repo_format()
2012
bd.repository_format = repo_format_class()
2003
2014
self.register(key, helper, help, native, deprecated)
2098
2109
format_registry.set_default('knit')
2099
2110
format_registry.register_metadir('metaweave', 'RepositoryFormat7',
2100
2111
'Transitional format in 0.8. Slower than knit.',
2113
repo_module='bzrlib.repofmt.weaverepo')
2102
2114
format_registry.register_metadir('experimental-knit2', 'RepositoryFormatKnit2',
2103
2115
'Experimental successor to knit. Use at your own risk.')