~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

  • Committer: Aaron Bentley
  • Date: 2006-03-19 18:49:10 UTC
  • mto: This revision was merged to the branch mainline in revision 1644.
  • Revision ID: aaron.bentley@utoronto.ca-20060319184910-44558c38ac2077cf
Progress indicator for tree builts

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
 
        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.
50
51
        try:
194
195
        # regardless of contents
195
196
        self.assertFalse(t.has('lock/held/info'))
196
197
        repo.lock_write()
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()
 
198
        self.assertTrue(t.has('lock/held/info'))
202
199
 
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)
267
264
 
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
 
 
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())
 
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'))
280
279
 
281
280
    def test_shared_disk_layout(self):
282
281
        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())