~abentley/bzr/appenddir

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-02-07 18:33:42 UTC
  • mfrom: (5642.2.6 extra-workingtree-formats)
  • Revision ID: pqm@pqm.ubuntu.com-20110207183342-sid8o7k8d1c5ph7c
(jelmer) Allow registering "extra" working tree formats that can not be used
 in meta dirs. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2882
2882
    _formats = {}
2883
2883
    """The known formats."""
2884
2884
 
 
2885
    _extra_formats = []
 
2886
    """Extra formats that can not be used in a metadir."""
 
2887
 
2885
2888
    requires_rich_root = False
2886
2889
 
2887
2890
    upgrade_recommended = False
2944
2947
        klass._formats[format.get_format_string()] = format
2945
2948
 
2946
2949
    @classmethod
 
2950
    def register_extra_format(klass, format):
 
2951
        klass._extra_formats.append(format)
 
2952
 
 
2953
    @classmethod
 
2954
    def unregister_extra_format(klass, format):
 
2955
        klass._extra_formats.remove(format)
 
2956
 
 
2957
    @classmethod
 
2958
    def get_formats(klass):
 
2959
        return klass._formats.values() + klass._extra_formats
 
2960
 
 
2961
    @classmethod
2947
2962
    def set_default_format(klass, format):
2948
2963
        klass._default_format = format
2949
2964
 
3177
3192
WorkingTreeFormat.register_format(WorkingTreeFormat4())
3178
3193
WorkingTreeFormat.register_format(WorkingTreeFormat3())
3179
3194
WorkingTreeFormat.set_default_format(__default_format)
3180
 
# formats which have no format string are not discoverable
3181
 
# and not independently creatable, so are not registered.
3182
 
_legacy_formats = [WorkingTreeFormat2(),
3183
 
                   ]
 
3195
# Register extra formats which have no format string are not discoverable
 
3196
# and not independently creatable. They are implicitly created as part of
 
3197
# e.g. older Bazaar formats or foreign formats.
 
3198
WorkingTreeFormat.register_extra_format(WorkingTreeFormat2())