48
47
transport as _mod_transport,
52
from breezy.bzr import (
53
branch as _mod_bzrbranch,
56
from breezy.branchfmt import fullhistory as fullhistorybranch
58
from breezy.bzr import fullhistory as fullhistorybranch
57
59
from breezy.repofmt import knitpack_repo
58
60
from breezy.transport import (
59
61
do_catching_redirections,
922
924
This might be a synthetic object for e.g. RemoteBranch and SVN.
924
from .bzrbranch import BranchFormatMetadir
926
from .branch import BranchFormatMetadir
925
927
return BranchFormatMetadir.find_format(self, name=name)
927
929
def _get_mkdir_mode(self):
933
935
def get_branch_reference(self, name=None):
934
936
"""See BzrDir.get_branch_reference()."""
935
from .bzrbranch import BranchFormatMetadir
937
from .branch import BranchFormatMetadir
936
938
format = BranchFormatMetadir.find_format(self, name=name)
937
939
return format.get_reference(self, name=name)
1027
1029
Note: if you're going to open the working tree, you should just go
1028
1030
ahead and try, and not ask permission first.
1030
from .bzrworkingtree import WorkingTreeFormatMetaDir
1032
from .workingtree import WorkingTreeFormatMetaDir
1032
1034
WorkingTreeFormatMetaDir.find_format_string(self)
1033
1035
except errors.NoWorkingTree:
1077
1079
def open_repository(self, unsupported=False):
1078
1080
"""See BzrDir.open_repository."""
1079
from .bzrrepository import RepositoryFormatMetaDir
1081
from .repository import RepositoryFormatMetaDir
1080
1082
format = RepositoryFormatMetaDir.find_format(self)
1081
1083
format.check_support_status(unsupported)
1082
1084
return format.open(self, _found=True)
1084
1086
def open_workingtree(self, unsupported=False,
1085
1087
recommend_upgrade=True):
1086
1088
"""See BzrDir.open_workingtree."""
1087
from .bzrworkingtree import WorkingTreeFormatMetaDir
1089
from .workingtree import WorkingTreeFormatMetaDir
1088
1090
format = WorkingTreeFormatMetaDir.find_format(self)
1089
1091
format.check_support_status(unsupported, recommend_upgrade,
1090
1092
basedir=self.root_transport.base)
1281
1283
raise errors.NotBranchError(path=transport.base)
1282
1284
if server_version != '2':
1283
1285
raise errors.NotBranchError(path=transport.base)
1284
from .remote import RemoteBzrDirFormat
1286
from ..remote import RemoteBzrDirFormat
1285
1287
return RemoteBzrDirFormat()
1288
1290
def known_formats(cls):
1289
from .remote import RemoteBzrDirFormat
1291
from ..remote import RemoteBzrDirFormat
1290
1292
return {RemoteBzrDirFormat()}
1322
1324
if not isinstance(self, BzrDirMetaFormat1):
1323
1325
return self._initialize_on_transport_vfs(transport)
1324
from .remote import RemoteBzrDirFormat
1326
from ..remote import RemoteBzrDirFormat
1325
1327
remote_format = RemoteBzrDirFormat()
1326
1328
self._supply_sub_formats_to(remote_format)
1327
1329
return remote_format.initialize_on_transport(transport)
1365
1367
except errors.NoSmartMedium:
1368
from .remote import RemoteBzrDirFormat
1370
from ..remote import RemoteBzrDirFormat
1369
1371
# TODO: lookup the local format from a server hint.
1370
1372
remote_dir_format = RemoteBzrDirFormat()
1371
1373
remote_dir_format._network_name = self.network_name()
1643
1645
if target_branch is None:
1645
1647
# TODO: bad monkey, hard-coded formats...
1646
from .bzrbranch import BzrBranchFormat7
1648
from .branch import BzrBranchFormat7
1647
1649
new_branch_format = BzrBranchFormat7()
1649
1651
new_branch_format = target_branch._format
2110
2112
register_metadir(controldir.format_registry, 'knit',
2111
2113
'breezy.repofmt.knitrepo.RepositoryFormatKnit1',
2112
2114
'Format using knits. Recommended for interoperation with bzr <= 0.14.',
2113
branch_format='breezy.branchfmt.fullhistory.BzrBranchFormat5',
2114
tree_format='breezy.workingtree_3.WorkingTreeFormat3',
2115
branch_format='breezy.bzr.fullhistory.BzrBranchFormat5',
2116
tree_format='breezy.bzr.workingtree_3.WorkingTreeFormat3',
2116
2118
deprecated=True)
2117
2119
register_metadir(controldir.format_registry, 'dirstate',
2119
2121
help='Format using dirstate for working trees. '
2120
2122
'Compatible with bzr 0.8 and '
2121
2123
'above when accessed over the network. Introduced in bzr 0.15.',
2122
branch_format='breezy.branchfmt.fullhistory.BzrBranchFormat5',
2123
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2124
branch_format='breezy.bzr.fullhistory.BzrBranchFormat5',
2125
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2125
2127
deprecated=True)
2126
2128
register_metadir(controldir.format_registry, 'dirstate-tags',
2127
2129
'breezy.repofmt.knitrepo.RepositoryFormatKnit1',
2128
2130
help='Variant of dirstate with support for tags. '
2129
2131
'Introduced in bzr 0.15.',
2130
branch_format='breezy.bzrbranch.BzrBranchFormat6',
2131
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2132
branch_format='breezy.bzr.branch.BzrBranchFormat6',
2133
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2133
2135
deprecated=True)
2134
2136
register_metadir(controldir.format_registry, 'rich-root',
2135
2137
'breezy.repofmt.knitrepo.RepositoryFormatKnit4',
2136
2138
help='Variant of dirstate with better handling of tree roots. '
2137
2139
'Introduced in bzr 1.0',
2138
branch_format='breezy.bzrbranch.BzrBranchFormat6',
2139
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2140
branch_format='breezy.bzr.branch.BzrBranchFormat6',
2141
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2141
2143
deprecated=True)
2142
2144
register_metadir(controldir.format_registry, 'dirstate-with-subtree',
2143
2145
'breezy.repofmt.knitrepo.RepositoryFormatKnit3',
2144
2146
help='Variant of dirstate with support for nested trees. '
2145
2147
'Introduced in 0.15.',
2146
branch_format='breezy.bzrbranch.BzrBranchFormat6',
2147
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2148
branch_format='breezy.bzr.branch.BzrBranchFormat6',
2149
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2148
2150
experimental=True,
2154
2156
'Interoperates with bzr repositories before 0.92 but cannot be '
2155
2157
'read by bzr < 0.92. '
2157
branch_format='breezy.bzrbranch.BzrBranchFormat6',
2158
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2159
branch_format='breezy.bzr.branch.BzrBranchFormat6',
2160
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2159
2161
deprecated=True,
2161
2163
register_metadir(controldir.format_registry, 'pack-0.92-subtree',
2164
2166
'Introduced in 0.92. Interoperates with '
2165
2167
'bzr repositories before 0.92 but cannot be read by bzr < 0.92. '
2167
branch_format='breezy.bzrbranch.BzrBranchFormat6',
2168
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2169
branch_format='breezy.bzr.branch.BzrBranchFormat6',
2170
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2170
2172
deprecated=True,
2171
2173
experimental=True,
2174
2176
'breezy.repofmt.knitpack_repo.RepositoryFormatKnitPack4',
2175
2177
help='A variant of pack-0.92 that supports rich-root data '
2176
2178
'(needed for bzr-svn and bzr-git). Introduced in 1.0.',
2177
branch_format='breezy.bzrbranch.BzrBranchFormat6',
2178
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2179
branch_format='breezy.bzr.branch.BzrBranchFormat6',
2180
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2180
2182
deprecated=True,
2184
2186
help='A format that allows a branch to indicate that there is another '
2185
2187
'(stacked) repository that should be used to access data that is '
2186
2188
'not present locally.',
2187
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2188
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2189
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2190
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2190
2192
deprecated=True,
2193
2195
'breezy.repofmt.knitpack_repo.RepositoryFormatKnitPack5RichRoot',
2194
2196
help='A variant of 1.6 that supports rich-root data '
2195
2197
'(needed for bzr-svn and bzr-git).',
2196
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2197
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2198
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2199
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2199
2201
deprecated=True,
2203
2205
help='A repository format using B+tree indexes. These indexes '
2204
2206
'are smaller in size, have smarter caching and provide faster '
2205
2207
'performance for most operations.',
2206
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2207
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2208
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2209
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2209
2211
deprecated=True,
2212
2214
'breezy.repofmt.knitpack_repo.RepositoryFormatKnitPack6RichRoot',
2213
2215
help='A variant of 1.9 that supports rich-root data '
2214
2216
'(needed for bzr-svn and bzr-git).',
2215
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2216
tree_format='breezy.workingtree_4.WorkingTreeFormat4',
2217
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2218
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4',
2218
2220
deprecated=True,
2220
2222
register_metadir(controldir.format_registry, '1.14',
2221
2223
'breezy.repofmt.knitpack_repo.RepositoryFormatKnitPack6',
2222
2224
help='A working-tree format that supports content filtering.',
2223
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2224
tree_format='breezy.workingtree_4.WorkingTreeFormat5',
2225
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2226
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat5',
2226
2228
deprecated=True,
2229
2231
'breezy.repofmt.knitpack_repo.RepositoryFormatKnitPack6RichRoot',
2230
2232
help='A variant of 1.14 that supports rich-root data '
2231
2233
'(needed for bzr-svn and bzr-git).',
2232
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2233
tree_format='breezy.workingtree_4.WorkingTreeFormat5',
2234
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2235
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat5',
2235
2237
deprecated=True,
2243
2245
'this format can only be read by bzr.dev. Please read '
2244
2246
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
2246
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2247
tree_format='breezy.workingtree_4.WorkingTreeFormat6',
2248
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2249
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6',
2248
2250
experimental=True,
2250
2252
alias=False, # Restore to being an alias when an actual development subtree format is added
2259
2261
'this format can only be read by bzr.dev. Please read '
2260
2262
'http://doc.bazaar.canonical.com/latest/developers/development-repo.html '
2262
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2263
tree_format='breezy.workingtree_4.WorkingTreeFormat6',
2264
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2265
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6',
2264
2266
experimental=True,
2269
2271
register_metadir(controldir.format_registry, 'development-colo',
2270
2272
'breezy.repofmt.groupcompress_repo.RepositoryFormat2a',
2271
2273
help='The 2a format with experimental support for colocated branches.\n',
2272
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2273
tree_format='breezy.workingtree_4.WorkingTreeFormat6',
2274
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2275
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6',
2274
2276
experimental=True,
2275
2277
bzrdir_format=BzrDirMetaFormat1Colo,
2286
2288
'Provides rich roots which are a one-way transition.\n',
2287
2289
# 'storage in packs, 255-way hashed CHK inventory, bencode revision, group compress, '
2288
2290
# 'rich roots. Supported by bzr 1.16 and later.',
2289
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2290
tree_format='breezy.workingtree_4.WorkingTreeFormat6',
2291
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2292
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6',
2291
2293
experimental=False,
2295
2297
# of the default format
2296
2298
register_metadir(controldir.format_registry, 'default-rich-root',
2297
2299
'breezy.repofmt.groupcompress_repo.RepositoryFormat2a',
2298
branch_format='breezy.bzrbranch.BzrBranchFormat7',
2299
tree_format='breezy.workingtree_4.WorkingTreeFormat6',
2300
branch_format='breezy.bzr.branch.BzrBranchFormat7',
2301
tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6',
2302
2304
help='Same as 2a.')