69
69
"""See RepositoryFormat.get_format_string()."""
70
70
return "Sample .bzr repository format."
72
def initialize(self, a_bzrdir):
72
def initialize(self, a_bzrdir, shared=False):
73
73
"""Initialize a repository in a BzrDir"""
74
74
t = a_bzrdir.get_repository_transport(self)
75
75
t.put('format', StringIO(self.get_format_string()))
144
144
def test_disk_layout(self):
145
145
control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
146
146
repo = repository.RepositoryFormat7().initialize(control)
148
# format 'Bazaar-NG Repository format 7'
150
# inventory.weave == empty_weave
151
# empty revision-store directory
152
# empty weaves directory
153
t = control.get_repository_transport(None)
154
self.assertEqualDiff('Bazaar-NG Repository format 7',
155
t.get('format').read())
156
self.assertEqualDiff('', t.get('lock').read())
147
# in case of side effects of locking.
151
# format 'Bazaar-NG Repository format 7'
153
# inventory.weave == empty_weave
154
# empty revision-store directory
155
# empty weaves directory
156
t = control.get_repository_transport(None)
157
self.assertEqualDiff('Bazaar-NG Repository format 7',
158
t.get('format').read())
159
self.assertEqualDiff('', t.get('lock').read())
160
self.assertTrue(S_ISDIR(t.stat('revision-store').st_mode))
161
self.assertTrue(S_ISDIR(t.stat('weaves').st_mode))
162
self.assertEqualDiff('# bzr weave file v5\n'
165
t.get('inventory.weave').read())
167
def test_shared_disk_layout(self):
168
control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
169
repo = repository.RepositoryFormat7().initialize(control, shared=True)
171
# format 'Bazaar-NG Repository format 7'
173
# inventory.weave == empty_weave
174
# empty revision-store directory
175
# empty weaves directory
176
# a 'shared-storage' marker file.
177
t = control.get_repository_transport(None)
178
self.assertEqualDiff('Bazaar-NG Repository format 7',
179
t.get('format').read())
180
self.assertEqualDiff('', t.get('lock').read())
181
self.assertEqualDiff('', t.get('shared-storage').read())
182
self.assertTrue(S_ISDIR(t.stat('revision-store').st_mode))
183
self.assertTrue(S_ISDIR(t.stat('weaves').st_mode))
184
self.assertEqualDiff('# bzr weave file v5\n'
187
t.get('inventory.weave').read())
189
def test_shared_no_tree_disk_layout(self):
190
control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
191
repo = repository.RepositoryFormat7().initialize(control, shared=True)
192
repo.set_make_working_trees(False)
194
# format 'Bazaar-NG Repository format 7'
196
# inventory.weave == empty_weave
197
# empty revision-store directory
198
# empty weaves directory
199
# a 'shared-storage' marker file.
200
t = control.get_repository_transport(None)
201
self.assertEqualDiff('Bazaar-NG Repository format 7',
202
t.get('format').read())
203
self.assertEqualDiff('', t.get('lock').read())
204
self.assertEqualDiff('', t.get('shared-storage').read())
205
self.assertEqualDiff('', t.get('no-working-trees').read())
206
repo.set_make_working_trees(True)
207
self.assertFalse(t.has('no-working-trees'))
157
208
self.assertTrue(S_ISDIR(t.stat('revision-store').st_mode))
158
209
self.assertTrue(S_ISDIR(t.stat('weaves').st_mode))
159
210
self.assertEqualDiff('# bzr weave file v5\n'