~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Ian Clatworthy
  • Date: 2007-10-25 01:55:55 UTC
  • mto: (2940.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 2941.
  • Revision ID: ian.clatworthy@internode.on.net-20071025015555-u126vma8knfv19ao
allow bzrdir formats to be registered as experimental

Show diffs side-by-side

added added

removed removed

Lines of Context:
2293
2293
 
2294
2294
class BzrDirFormatInfo(object):
2295
2295
 
2296
 
    def __init__(self, native, deprecated, hidden):
 
2296
    def __init__(self, native, deprecated, hidden, experimental):
2297
2297
        self.deprecated = deprecated
2298
2298
        self.native = native
2299
2299
        self.hidden = hidden
 
2300
        self.experimental = experimental
2300
2301
 
2301
2302
 
2302
2303
class BzrDirFormatRegistry(registry.Registry):
2310
2311
             repository_format, help, native=True, deprecated=False,
2311
2312
             branch_format=None,
2312
2313
             tree_format=None,
2313
 
             hidden=False):
 
2314
             hidden=False,
 
2315
             experimental=False):
2314
2316
        """Register a metadir subformat.
2315
2317
 
2316
2318
        These all use a BzrDirMetaFormat1 bzrdir, but can be parameterized
2348
2350
            if repository_format is not None:
2349
2351
                bd.repository_format = _load(repository_format)
2350
2352
            return bd
2351
 
        self.register(key, helper, help, native, deprecated, hidden)
 
2353
        self.register(key, helper, help, native, deprecated, hidden,
 
2354
            experimental)
2352
2355
 
2353
2356
    def register(self, key, factory, help, native=True, deprecated=False,
2354
 
                 hidden=False):
 
2357
                 hidden=False, experimental=False):
2355
2358
        """Register a BzrDirFormat factory.
2356
2359
        
2357
2360
        The factory must be a callable that takes one parameter: the key.
2361
2364
        supplied directly.
2362
2365
        """
2363
2366
        registry.Registry.register(self, key, factory, help, 
2364
 
            BzrDirFormatInfo(native, deprecated, hidden))
 
2367
            BzrDirFormatInfo(native, deprecated, hidden, experimental))
2365
2368
 
2366
2369
    def register_lazy(self, key, module_name, member_name, help, native=True,
2367
 
                      deprecated=False, hidden=False):
 
2370
                      deprecated=False, hidden=False, experimental=False):
2368
2371
        registry.Registry.register_lazy(self, key, module_name, member_name, 
2369
 
            help, BzrDirFormatInfo(native, deprecated, hidden))
 
2372
            help, BzrDirFormatInfo(native, deprecated, hidden, experimental))
2370
2373
 
2371
2374
    def set_default(self, key):
2372
2375
        """Set the 'default' key to be a clone of the supplied key.
2419
2422
            output += wrapped(default_realkey, '(default) %s' % default_help,
2420
2423
                              self.get_info('default'))
2421
2424
        deprecated_pairs = []
 
2425
        experimental_pairs = []
2422
2426
        for key, help in help_pairs:
2423
2427
            info = self.get_info(key)
2424
2428
            if info.hidden:
2425
2429
                continue
2426
2430
            elif info.deprecated:
2427
2431
                deprecated_pairs.append((key, help))
 
2432
            elif info.experimental:
 
2433
                experimental_pairs.append((key, help))
2428
2434
            else:
2429
2435
                output += wrapped(key, help, info)
 
2436
        if len(experimental_pairs) > 0:
 
2437
            output += "Experimental formats are shown below.\n\n"
 
2438
            for key, help in experimental_pairs:
 
2439
                info = self.get_info(key)
 
2440
                output += wrapped(key, help, info)
2430
2441
        if len(deprecated_pairs) > 0:
2431
2442
            output += "Deprecated formats are shown below.\n\n"
2432
2443
            for key, help in deprecated_pairs:
2486
2497
        'not be upgradable to release formats of bzr.',
2487
2498
    branch_format='bzrlib.branch.BzrBranchFormat6',
2488
2499
    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
2489
 
    hidden=True,
 
2500
    experimental=True,
2490
2501
    )
2491
2502
format_registry.register_metadir('knitpack-subtree',
2492
2503
    'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack3',