52
55
self.assertEqual(old_format, bzrdir.BzrDirFormat.get_default_format())
58
class TestFormatRegistry(TestCase):
60
def make_format_registry(self):
61
my_format_registry = bzrdir.BzrDirFormatRegistry()
62
my_format_registry.register('weave', bzrdir.BzrDirFormat6,
63
'Pre-0.8 format. Slower and does not support checkouts or shared'
64
' repositories', deprecated=True)
65
my_format_registry.register_lazy('lazy', 'bzrlib.bzrdir',
66
'BzrDirFormat6', 'Format registered lazily', deprecated=True)
67
my_format_registry.register_metadir('knit', 'RepositoryFormatKnit1',
69
my_format_registry.set_default('knit')
70
my_format_registry.register_metadir('metaweave', 'RepositoryFormat7',
71
'Transitional format in 0.8. Slower than knit.', deprecated=True)
72
my_format_registry.register_metadir('experimental-knit2',
73
'RepositoryFormatKnit2',
74
'Experimental successor to knit. Use at your own risk.')
75
return my_format_registry
77
def test_format_registry(self):
78
my_format_registry = self.make_format_registry()
79
my_bzrdir = my_format_registry.make_bzrdir('lazy')
80
self.assertIsInstance(my_bzrdir, bzrdir.BzrDirFormat6)
81
my_bzrdir = my_format_registry.make_bzrdir('weave')
82
self.assertIsInstance(my_bzrdir, bzrdir.BzrDirFormat6)
83
my_bzrdir = my_format_registry.make_bzrdir('default')
84
self.assertIsInstance(my_bzrdir.repository_format,
85
repository.RepositoryFormatKnit1)
86
my_bzrdir = my_format_registry.make_bzrdir('knit')
87
self.assertIsInstance(my_bzrdir.repository_format,
88
repository.RepositoryFormatKnit1)
89
my_bzrdir = my_format_registry.make_bzrdir('metaweave')
90
self.assertIsInstance(my_bzrdir.repository_format,
91
repository.RepositoryFormat7)
93
def test_get_help(self):
94
my_format_registry = self.make_format_registry()
95
self.assertEqual('Format registered lazily',
96
my_format_registry.get_help('lazy'))
97
self.assertEqual('Format using knits',
98
my_format_registry.get_help('knit'))
99
self.assertEqual('Format using knits',
100
my_format_registry.get_help('default'))
101
self.assertEqual('Pre-0.8 format. Slower and does not support'
102
' checkouts or shared repositories',
103
my_format_registry.get_help('weave'))
105
def test_help_topic(self):
106
topics = help_topics.HelpTopicRegistry()
107
topics.register('formats', self.make_format_registry().help_topic,
109
topic = topics.get_detail('formats')
110
new, deprecated = topic.split('Deprecated formats')
111
self.assertContainsRe(new, 'Bazaar directory formats')
112
self.assertContainsRe(new,
113
' knit/default:\n \(native\) Format using knits\n')
114
self.assertContainsRe(deprecated,
115
' lazy:\n \(native\) Format registered lazily\n')
55
117
class SampleBranch(bzrlib.branch.Branch):
56
118
"""A dummy branch for guess what, dummy use."""