45
45
def test_get_set_default_format(self):
46
46
old_format = repository.RepositoryFormat.get_default_format()
47
# default is None - we cannot create a Repository independently yet
48
self.assertTrue(isinstance(old_format, repository.RepositoryFormat7))
47
self.assertTrue(isinstance(old_format, repository.RepositoryFormatKnit1))
49
48
repository.RepositoryFormat.set_default_format(SampleRepositoryFormat())
50
49
# creating a repository should now create an instrumented dir.
195
194
# regardless of contents
196
195
self.assertFalse(t.has('lock/held/info'))
197
196
repo.lock_write()
198
self.assertTrue(t.has('lock/held/info'))
198
self.assertTrue(t.has('lock/held/info'))
200
# unlock so we don't get a warning about failing to do so
200
203
def test_uses_lockdir(self):
201
204
"""repo format 7 actually locks on lockdir"""
262
265
self.assertTrue(S_ISDIR(t.stat('knits').st_mode))
263
266
self.check_knits(t)
268
def assertHasKnit(self, t, knit_name):
269
"""Assert that knit_name exists on t."""
270
self.assertEqualDiff('# bzr knit index 8\n',
271
t.get(knit_name + '.kndx').read())
273
self.assertTrue(t.has(knit_name + '.knit'))
265
275
def check_knits(self, t):
266
276
"""check knit content for a repository."""
267
self.assertEqualDiff('# bzr knit index 7\n',
268
t.get('inventory.kndx').read())
270
self.assertTrue(t.has('inventory.knit'))
271
self.assertEqualDiff('# bzr knit index 7\n',
272
t.get('revisions.kndx').read())
274
self.assertTrue(t.has('revisions.knit'))
275
self.assertEqualDiff('# bzr knit index 7\n',
276
t.get('signatures.kndx').read())
278
self.assertTrue(t.has('signatures.knit'))
277
self.assertHasKnit(t, 'inventory')
278
self.assertHasKnit(t, 'revisions')
279
self.assertHasKnit(t, 'signatures')
280
281
def test_shared_disk_layout(self):
281
282
control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())