~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_pack_repository.py

  • Committer: John Arbash Meinel
  • Date: 2009-05-29 12:52:20 UTC
  • mto: This revision was merged to the branch mainline in revision 4460.
  • Revision ID: john@arbash-meinel.com-20090529125220-idiknsd81ihvkacm
Change how 'missing.*parent_prevents_commit' determines what to skip.
It was skipping everything, rather than just dev6.
Also, fix it to always call abort_write_group, even if it skipped the test.
Otherwise, it was failing to clean up the working dirs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    upgrade,
39
39
    workingtree,
40
40
    )
 
41
from bzrlib.repofmt import (
 
42
    pack_repo,
 
43
    groupcompress_repo,
 
44
    )
41
45
from bzrlib.repofmt.groupcompress_repo import RepositoryFormatCHK1
42
46
from bzrlib.smart import (
43
47
    client,
556
560
            missing_ghost.get_inventory, 'ghost')
557
561
 
558
562
    def make_write_ready_repo(self):
559
 
        repo = self.make_repository('.', format=self.get_format())
 
563
        format = self.get_format()
 
564
        if isinstance(format.repository_format, RepositoryFormatCHK1):
 
565
            raise TestNotApplicable("No missing compression parents")
 
566
        repo = self.make_repository('.', format=format)
560
567
        repo.lock_write()
 
568
        self.addCleanup(repo.unlock)
561
569
        repo.start_write_group()
 
570
        self.addCleanup(repo.abort_write_group)
562
571
        return repo
563
572
 
564
573
    def test_missing_inventories_compression_parent_prevents_commit(self):
565
574
        repo = self.make_write_ready_repo()
566
575
        key = ('junk',)
567
 
        if not getattr(repo.inventories._index, '_missing_compression_parents',
568
 
            None):
569
 
            raise TestSkipped("No missing compression parents")
570
576
        repo.inventories._index._missing_compression_parents.add(key)
571
577
        self.assertRaises(errors.BzrCheckError, repo.commit_write_group)
572
578
        self.assertRaises(errors.BzrCheckError, repo.commit_write_group)
573
 
        repo.abort_write_group()
574
 
        repo.unlock()
575
579
 
576
580
    def test_missing_revisions_compression_parent_prevents_commit(self):
577
581
        repo = self.make_write_ready_repo()
578
582
        key = ('junk',)
579
 
        if not getattr(repo.inventories._index, '_missing_compression_parents',
580
 
            None):
581
 
            raise TestSkipped("No missing compression parents")
582
583
        repo.revisions._index._missing_compression_parents.add(key)
583
584
        self.assertRaises(errors.BzrCheckError, repo.commit_write_group)
584
585
        self.assertRaises(errors.BzrCheckError, repo.commit_write_group)
585
 
        repo.abort_write_group()
586
 
        repo.unlock()
587
586
 
588
587
    def test_missing_signatures_compression_parent_prevents_commit(self):
589
588
        repo = self.make_write_ready_repo()
590
589
        key = ('junk',)
591
 
        if not getattr(repo.inventories._index, '_missing_compression_parents',
592
 
            None):
593
 
            raise TestSkipped("No missing compression parents")
594
590
        repo.signatures._index._missing_compression_parents.add(key)
595
591
        self.assertRaises(errors.BzrCheckError, repo.commit_write_group)
596
592
        self.assertRaises(errors.BzrCheckError, repo.commit_write_group)
597
 
        repo.abort_write_group()
598
 
        repo.unlock()
599
593
 
600
594
    def test_missing_text_compression_parent_prevents_commit(self):
601
595
        repo = self.make_write_ready_repo()
602
596
        key = ('some', 'junk')
603
 
        if not getattr(repo.inventories._index, '_missing_compression_parents',
604
 
            None):
605
 
            raise TestSkipped("No missing compression parents")
606
597
        repo.texts._index._missing_compression_parents.add(key)
607
598
        self.assertRaises(errors.BzrCheckError, repo.commit_write_group)
608
599
        e = self.assertRaises(errors.BzrCheckError, repo.commit_write_group)
609
 
        repo.abort_write_group()
610
 
        repo.unlock()
611
600
 
612
601
    def test_supports_external_lookups(self):
613
602
        repo = self.make_repository('.', format=self.get_format())