213
213
t.get('inventory.weave').read())
216
class TestFormatKnit1(TestCaseWithTransport):
218
def test_disk_layout(self):
219
control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
220
repo = repository.RepositoryFormatKnit1().initialize(control)
221
# in case of side effects of locking.
225
# format 'Bazaar-NG Knit Repository Format 1'
227
# inventory.weave == empty_weave
228
# empty revision-store directory
229
# empty weaves directory
230
t = control.get_repository_transport(None)
231
self.assertEqualDiff('Bazaar-NG Knit Repository Format 1',
232
t.get('format').read())
233
self.assertEqualDiff('', t.get('lock').read())
234
self.assertTrue(S_ISDIR(t.stat('revision-store').st_mode))
235
self.assertTrue(S_ISDIR(t.stat('knits').st_mode))
236
# cheating and using a weave for now.
237
self.assertEqualDiff('# bzr weave file v5\n'
240
t.get('inventory.weave').read())
242
def test_shared_disk_layout(self):
243
control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
244
repo = repository.RepositoryFormatKnit1().initialize(control, shared=True)
246
# format 'Bazaar-NG Knit Repository Format 1'
248
# inventory.weave == empty_weave
249
# empty revision-store directory
250
# empty weaves directory
251
# a 'shared-storage' marker file.
252
t = control.get_repository_transport(None)
253
self.assertEqualDiff('Bazaar-NG Knit Repository Format 1',
254
t.get('format').read())
255
self.assertEqualDiff('', t.get('lock').read())
256
self.assertEqualDiff('', t.get('shared-storage').read())
257
self.assertTrue(S_ISDIR(t.stat('revision-store').st_mode))
258
self.assertTrue(S_ISDIR(t.stat('knits').st_mode))
259
# cheating and using a weave for now.
260
self.assertEqualDiff('# bzr weave file v5\n'
263
t.get('inventory.weave').read())
265
def test_shared_no_tree_disk_layout(self):
266
control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
267
repo = repository.RepositoryFormatKnit1().initialize(control, shared=True)
268
repo.set_make_working_trees(False)
270
# format 'Bazaar-NG Knit Repository Format 1'
272
# inventory.weave == empty_weave
273
# empty revision-store directory
274
# empty weaves directory
275
# a 'shared-storage' marker file.
276
t = control.get_repository_transport(None)
277
self.assertEqualDiff('Bazaar-NG Knit Repository Format 1',
278
t.get('format').read())
279
self.assertEqualDiff('', t.get('lock').read())
280
self.assertEqualDiff('', t.get('shared-storage').read())
281
self.assertEqualDiff('', t.get('no-working-trees').read())
282
repo.set_make_working_trees(True)
283
self.assertFalse(t.has('no-working-trees'))
284
self.assertTrue(S_ISDIR(t.stat('revision-store').st_mode))
285
self.assertTrue(S_ISDIR(t.stat('knits').st_mode))
286
# cheating and using a weave for now.
287
self.assertEqualDiff('# bzr weave file v5\n'
290
t.get('inventory.weave').read())
216
293
class InterString(repository.InterRepository):
217
294
"""An inter-repository optimised code path for strings.
282
359
formats = [repository.RepositoryFormat5(),
283
360
repository.RepositoryFormat6(),
284
361
repository.RepositoryFormat7()]
362
incompatible_formats = [repository.RepositoryFormat4(),
363
repository.RepositoryFormatKnit1(),
285
365
repo_a = self.make_repository('a')
286
366
repo_b = self.make_repository('b')
287
# force incompatible left then right
288
repo_a._format = repository.RepositoryFormat4()
289
repo_b._format = formats[0]
290
367
is_compatible = repository.InterWeaveRepo.is_compatible
291
self.assertFalse(is_compatible(repo_a, repo_b))
292
self.assertFalse(is_compatible(repo_b, repo_a))
368
for source in incompatible_formats:
369
# force incompatible left then right
370
repo_a._format = source
371
repo_b._format = formats[0]
372
self.assertFalse(is_compatible(repo_a, repo_b))
373
self.assertFalse(is_compatible(repo_b, repo_a))
293
374
for source in formats:
294
375
repo_a._format = source
295
376
for target in formats: