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):
1310
1309
def __return_repository_format(self):
1311
1310
"""Circular import protection."""
1312
from bzrlib.repository import RepositoryFormat4
1311
from bzrlib.repofmt.weaverepo import RepositoryFormat4
1313
1312
return RepositoryFormat4()
1314
1313
repository_format = property(__return_repository_format)
1349
1348
Except when they are being cloned.
1351
1350
from bzrlib.branch import BzrBranchFormat4
1352
from bzrlib.repository import RepositoryFormat5
1351
from bzrlib.repofmt.weaverepo import RepositoryFormat5
1353
1352
from bzrlib.workingtree import WorkingTreeFormat2
1354
1353
result = (super(BzrDirFormat5, self).initialize_on_transport(transport))
1355
1354
RepositoryFormat5().initialize(result, _internal=True)
1370
1369
def __return_repository_format(self):
1371
1370
"""Circular import protection."""
1372
from bzrlib.repository import RepositoryFormat5
1371
from bzrlib.repofmt.weaverepo import RepositoryFormat5
1373
1372
return RepositoryFormat5()
1374
1373
repository_format = property(__return_repository_format)
1408
1407
Except when they are being cloned.
1410
1409
from bzrlib.branch import BzrBranchFormat4
1411
from bzrlib.repository import RepositoryFormat6
1410
from bzrlib.repofmt.weaverepo import RepositoryFormat6
1412
1411
from bzrlib.workingtree import WorkingTreeFormat2
1413
1412
result = super(BzrDirFormat6, self).initialize_on_transport(transport)
1414
1413
RepositoryFormat6().initialize(result, _internal=True)
1429
1428
def __return_repository_format(self):
1430
1429
"""Circular import protection."""
1431
from bzrlib.repository import RepositoryFormat6
1430
from bzrlib.repofmt.weaverepo import RepositoryFormat6
1432
1431
return RepositoryFormat6()
1433
1432
repository_format = property(__return_repository_format)
1857
1856
def convert(self, to_convert, pb):
1858
1857
"""See Converter.convert()."""
1858
from bzrlib.repofmt.weaverepo import RepositoryFormat7
1859
1859
from bzrlib.branch import BzrBranchFormat5
1860
1860
self.bzrdir = to_convert
1891
1891
# we hard code the formats here because we are converting into
1892
1892
# the meta format. The meta format upgrader can take this to a
1893
1893
# future format within each component.
1894
self.put_format('repository', _mod_repository.RepositoryFormat7())
1894
self.put_format('repository', RepositoryFormat7())
1895
1895
for entry in repository_names:
1896
1896
self.move_entry('repository', entry)
2024
2024
def register_metadir(self, key, repo, help, native=True, deprecated=False,
2025
branch_format=None):
2025
repo_module='bzrlib.repository', branch_format=None):
2026
2026
"""Register a metadir subformat.
2028
repo is the repository format name as a string.
2028
These all use a BzrDirMetaFormat1 bzrdir, but can be parameterized
2029
by the Repository format.
2031
:param repo: The repository format class name as a string.
2033
:param repo_module: The module from which the repository class
2034
should be lazily loaded. By default this is bzrlib.repository.
2030
2036
# This should be expanded to support setting WorkingTree and Branch
2031
2037
# formats, once BzrDirMetaFormat1 supports that.
2033
import bzrlib.repository
2034
2039
import bzrlib.branch
2035
repo_format = getattr(bzrlib.repository, repo)
2040
mod = __import__(repo_module, globals(), locals(), [repo])
2042
repo_format_class = getattr(mod, repo)
2043
except AttributeError:
2044
raise AttributeError('no repository format %r in module %r'
2036
2046
bd = BzrDirMetaFormat1()
2037
bd.repository_format = repo_format()
2047
bd.repository_format = repo_format_class()
2038
2048
if branch_format is not None:
2039
2049
bd.branch_format = getattr(bzrlib.branch, branch_format)()
2127
2137
format_registry = BzrDirFormatRegistry()
2128
2138
format_registry.register('weave', BzrDirFormat6,
2129
2139
'Pre-0.8 format. Slower than knit and does not'
2130
' support checkouts or shared repositories.', deprecated=True)
2131
format_registry.register_metadir('knit', 'RepositoryFormatKnit1',
2132
'Format using knits. Recommended.', branch_format='BzrBranchFormat5')
2140
' support checkouts or shared repositories.',
2142
format_registry.register_metadir('knit',
2143
'RepositoryFormatKnit1',
2144
'Format using knits. Recommended.',
2145
repo_module='bzrlib.repofmt.knitrepo', branch_format='BzrBranchFormat5')
2146
format_registry.set_default('knit')
2133
2147
format_registry.register_metadir('metaweave', 'RepositoryFormat7',
2134
2148
'Transitional format in 0.8. Slower than knit.',
2135
branch_format='BzrBranchFormat5',
2150
repo_module='bzrlib.repofmt.weaverepo')
2137
2151
format_registry.register_metadir('experimental-knit2', 'RepositoryFormatKnit2',
2138
2152
'Experimental successor to knit. Use at your own risk.',
2153
repo_module='bzrlib.repofmt.knitrepo',
2139
2154
branch_format='BzrBranchFormat5')
2140
2156
format_registry.register_metadir('experimental-branch6',
2141
2157
'RepositoryFormatKnit1',
2142
2158
'Experimental successor to knit. Use at your own risk.',
2159
repo_module='bzrlib.repofmt.knitrepo',
2143
2160
branch_format='BzrBranchFormat6')
2144
format_registry.set_default('knit')