/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/bzr/bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-08 23:30:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6690.
  • Revision ID: jelmer@jelmer.uk-20170608233031-3qavls2o7a1pqllj
Update imports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
import sys
31
31
 
32
 
from .lazy_import import lazy_import
 
32
from ..lazy_import import lazy_import
33
33
lazy_import(globals(), """
34
34
import breezy
35
35
from breezy import (
36
 
    bzrbranch as _mod_bzrbranch,
37
36
    cleanup,
38
37
    errors,
39
38
    fetch,
48
47
    transport as _mod_transport,
49
48
    ui,
50
49
    urlutils,
 
50
    win32utils,
 
51
    )
 
52
from breezy.bzr import (
 
53
    branch as _mod_bzrbranch,
51
54
    vf_search,
52
 
    win32utils,
53
55
    workingtree_3,
54
56
    workingtree_4,
55
57
    )
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,
62
64
from breezy.i18n import gettext
63
65
""")
64
66
 
65
 
from .trace import (
 
67
from ..trace import (
66
68
    mutter,
67
69
    note,
68
70
    )
69
71
 
70
 
from . import (
 
72
from .. import (
71
73
    config,
72
74
    controldir,
73
75
    registry,
921
923
 
922
924
        This might be a synthetic object for e.g. RemoteBranch and SVN.
923
925
        """
924
 
        from .bzrbranch import BranchFormatMetadir
 
926
        from .branch import BranchFormatMetadir
925
927
        return BranchFormatMetadir.find_format(self, name=name)
926
928
 
927
929
    def _get_mkdir_mode(self):
932
934
 
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)
938
940
 
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.
1029
1031
        """
1030
 
        from .bzrworkingtree import WorkingTreeFormatMetaDir
 
1032
        from .workingtree import WorkingTreeFormatMetaDir
1031
1033
        try:
1032
1034
            WorkingTreeFormatMetaDir.find_format_string(self)
1033
1035
        except errors.NoWorkingTree:
1076
1078
 
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()
1286
1288
 
1287
1289
    @classmethod
1288
1290
    def known_formats(cls):
1289
 
        from .remote import RemoteBzrDirFormat
 
1291
        from ..remote import RemoteBzrDirFormat
1290
1292
        return {RemoteBzrDirFormat()}
1291
1293
 
1292
1294
 
1321
1323
            # metadir1
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:
1366
1368
                pass
1367
1369
            else:
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:
1644
1646
                if do_upgrade:
1645
1647
                    # TODO: bad monkey, hard-coded formats...
1646
 
                    from .bzrbranch import BzrBranchFormat7
 
1648
                    from .branch import BzrBranchFormat7
1647
1649
                    new_branch_format = BzrBranchFormat7()
1648
1650
            else:
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',
2115
2117
    hidden=True,
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',
2124
2126
    hidden=True,
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',
2132
2134
    hidden=True,
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',
2140
2142
    hidden=True,
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,
2149
2151
    hidden=True,
2150
2152
    )
2154
2156
        'Interoperates with bzr repositories before 0.92 but cannot be '
2155
2157
        'read by bzr < 0.92. '
2156
2158
        ,
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,
2160
2162
    )
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. '
2166
2168
        ,
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',
2169
2171
    hidden=True,
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',
2179
2181
    hidden=True,
2180
2182
    deprecated=True,
2181
2183
    )
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',
2189
2191
    hidden=True,
2190
2192
    deprecated=True,
2191
2193
    )
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',
2198
2200
    hidden=True,
2199
2201
    deprecated=True,
2200
2202
    )
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',
2208
2210
    hidden=True,
2209
2211
    deprecated=True,
2210
2212
    )
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',
2217
2219
    hidden=True,
2218
2220
    deprecated=True,
2219
2221
    )
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',
2225
2227
    hidden=True,
2226
2228
    deprecated=True,
2227
2229
    )
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',
2234
2236
    hidden=True,
2235
2237
    deprecated=True,
2236
2238
    )
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 '
2245
2247
        'before use.',
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,
2249
2251
    hidden=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 '
2261
2263
        'before use.',
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,
2265
2267
    hidden=True,
2266
2268
    alias=False,
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,
2276
2278
    )
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,
2292
2294
    )
2293
2295
 
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',
2300
2302
    alias=True,
2301
2303
    hidden=True,
2302
2304
    help='Same as 2a.')