~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

  • Committer: abentley
  • Date: 2006-04-20 23:47:53 UTC
  • mfrom: (1681 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1683.
  • Revision ID: abentley@lappy-20060420234753-6a6874b76f09f86d
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
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.
51
50
        try:
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'))
 
197
        try:
 
198
            self.assertTrue(t.has('lock/held/info'))
 
199
        finally:
 
200
            # unlock so we don't get a warning about failing to do so
 
201
            repo.unlock()
199
202
 
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)
264
267
 
 
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())
 
272
        # no default content
 
273
        self.assertTrue(t.has(knit_name + '.knit'))
 
274
 
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())
269
 
        # no default content
270
 
        self.assertTrue(t.has('inventory.knit'))
271
 
        self.assertEqualDiff('# bzr knit index 7\n',
272
 
                             t.get('revisions.kndx').read())
273
 
        # no default content
274
 
        self.assertTrue(t.has('revisions.knit'))
275
 
        self.assertEqualDiff('# bzr knit index 7\n',
276
 
                             t.get('signatures.kndx').read())
277
 
        # no default content
278
 
        self.assertTrue(t.has('signatures.knit'))
 
277
        self.assertHasKnit(t, 'inventory')
 
278
        self.assertHasKnit(t, 'revisions')
 
279
        self.assertHasKnit(t, 'signatures')
279
280
 
280
281
    def test_shared_disk_layout(self):
281
282
        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())