~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    urlutils,
50
50
    xml4,
51
51
    xml5,
 
52
    workingtree,
 
53
    workingtree_4,
52
54
    )
53
55
from bzrlib.osutils import (
54
56
    safe_unicode,
1058
1060
        try:
1059
1061
            if not isinstance(self.open_branch()._format,
1060
1062
                              format.get_branch_format().__class__):
1061
 
                # the repository needs an upgrade.
 
1063
                # the branch needs an upgrade.
1062
1064
                return True
1063
1065
        except errors.NotBranchError:
1064
1066
            pass
1065
 
        # currently there are no other possible conversions for meta1 formats.
 
1067
        try:
 
1068
            if not isinstance(self.open_workingtree()._format,
 
1069
                              format.workingtree_format.__class__):
 
1070
                # the workingtree needs an upgrade.
 
1071
                return True
 
1072
        except (errors.NoWorkingTree, errors.NotLocalUrl):
 
1073
            pass
1066
1074
        return False
1067
1075
 
1068
1076
    def open_branch(self, unsupported=False):
2063
2071
        except errors.NotBranchError:
2064
2072
            pass
2065
2073
        else:
 
2074
            # TODO: conversions of Branch and Tree should be done by
 
2075
            # InterXFormat lookups
2066
2076
            # Avoid circular imports
2067
2077
            from bzrlib import branch as _mod_branch
2068
2078
            if (branch._format.__class__ is _mod_branch.BzrBranchFormat5 and
2070
2080
                _mod_branch.BzrBranchFormat6):
2071
2081
                branch_converter = _mod_branch.Converter5to6()
2072
2082
                branch_converter.convert(branch)
 
2083
        try:
 
2084
            tree = self.bzrdir.open_workingtree()
 
2085
        except (errors.NoWorkingTree, errors.NotLocalUrl):
 
2086
            pass
 
2087
        else:
 
2088
            # TODO: conversions of Branch and Tree should be done by
 
2089
            # InterXFormat lookups
 
2090
            if (isinstance(tree, workingtree.WorkingTree3) and
 
2091
                isinstance(self.target_format.workingtree_format,
 
2092
                    workingtree_4.WorkingTreeFormat4)):
 
2093
                workingtree_4.Converter3to4().convert(tree)
2073
2094
        return to_convert
2074
2095
 
2075
2096
 
2221
2242
    deprecated=True)
2222
2243
format_registry.register_metadir('knit',
2223
2244
    'bzrlib.repofmt.knitrepo.RepositoryFormatKnit1',
2224
 
    'Format using knits.  Recommended.',
2225
 
    branch_format='bzrlib.branch.BzrBranchFormat5')
 
2245
    'Format using knits.  Recommended for interoperation with bzr <= 0.14.',
 
2246
    branch_format='bzrlib.branch.BzrBranchFormat5',
 
2247
    tree_format='bzrlib.workingtree_4.WorkingTreeFormat3')
2226
2248
format_registry.set_default('knit')
2227
2249
format_registry.register_metadir('metaweave',
2228
2250
    'bzrlib.repofmt.weaverepo.RepositoryFormat7',
2229
2251
    'Transitional format in 0.8.  Slower than knit.',
 
2252
    branch_format='bzrlib.branch.BzrBranchFormat5',
 
2253
    tree_format='bzrlib.workingtree_4.WorkingTreeFormat3',
2230
2254
    deprecated=True)
2231
2255
format_registry.register_metadir('experimental-knit2',
2232
2256
    'bzrlib.repofmt.knitrepo.RepositoryFormatKnit2',
2247
2271
    branch_format='bzrlib.branch.BzrBranchFormat6',
2248
2272
    tree_format='bzrlib.workingtree_4.WorkingTreeFormat4',
2249
2273
    )
 
2274
format_registry.register_metadir('dirstate',
 
2275
    'bzrlib.repofmt.knitrepo.RepositoryFormatKnit1',
 
2276
    help='New in 0.15: Fast local operations. Compatible with bzr 0.8 and '
 
2277
        'above when accessed over the network.',
 
2278
    branch_format='bzrlib.branch.BzrBranchFormat5',
 
2279
    tree_format='bzrlib.workingtree_4.WorkingTreeFormat4',
 
2280
    )
 
2281
format_registry.register_metadir('dirstate-with-subtree',
 
2282
    'bzrlib.repofmt.knitrepo.RepositoryFormatKnit3',
 
2283
    help='New in 0.15: Fast local operations and improved scaling for '
 
2284
        'network operations. Additionally adds support for versioning nested '
 
2285
        'bzr branches. Incompatible with bzr < 0.15.',
 
2286
    branch_format='bzrlib.branch.BzrBranchFormat6',
 
2287
    tree_format='bzrlib.workingtree_4.WorkingTreeFormat4',
 
2288
    )