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