/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository/test_check.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-20 02:06:05 UTC
  • mfrom: (5802.2.2 move-reconcile)
  • Revision ID: pqm@pqm.ubuntu.com-20110420020605-0l0fdx2alnsbv5c9
(jelmer) Move more tests that require the full versioned file API from
 bt.per_repository to bt.per_repository_vf. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from bzrlib import (
21
21
    config as _mod_config,
22
 
    errors,
23
22
    revision as _mod_revision,
24
23
    )
25
 
from bzrlib.tests import TestNotApplicable
26
24
from bzrlib.tests.per_repository import TestCaseWithRepository
27
 
from bzrlib.tests.per_repository.helpers import (
28
 
    TestCaseWithBrokenRevisionIndex,
29
 
    )
30
25
 
31
26
 
32
27
class TestNoSpuriousInconsistentAncestors(TestCaseWithRepository):
45
40
        self.assertContainsRe(self.get_log(), "0 unreferenced text versions")
46
41
 
47
42
 
48
 
class TestFindInconsistentRevisionParents(TestCaseWithBrokenRevisionIndex):
49
 
 
50
 
    def test__find_inconsistent_revision_parents(self):
51
 
        """_find_inconsistent_revision_parents finds revisions with broken
52
 
        parents.
53
 
        """
54
 
        repo = self.make_repo_with_extra_ghost_index()
55
 
        self.assertEqual(
56
 
            [('revision-id', ('incorrect-parent',), ())],
57
 
            list(repo._find_inconsistent_revision_parents()))
58
 
 
59
 
    def test__check_for_inconsistent_revision_parents(self):
60
 
        """_check_for_inconsistent_revision_parents raises BzrCheckError if
61
 
        there are any revisions with inconsistent parents.
62
 
        """
63
 
        repo = self.make_repo_with_extra_ghost_index()
64
 
        self.assertRaises(
65
 
            errors.BzrCheckError,
66
 
            repo._check_for_inconsistent_revision_parents)
67
 
 
68
 
    def test__check_for_inconsistent_revision_parents_on_clean_repo(self):
69
 
        """_check_for_inconsistent_revision_parents does nothing if there are
70
 
        no broken revisions.
71
 
        """
72
 
        repo = self.make_repository('empty-repo')
73
 
        if not repo._format.revision_graph_can_have_wrong_parents:
74
 
            raise TestNotApplicable(
75
 
                '%r cannot have corrupt revision index.' % repo)
76
 
        repo.lock_read()
77
 
        try:
78
 
            repo._check_for_inconsistent_revision_parents()  # nothing happens
79
 
        finally:
80
 
            repo.unlock()
81
 
 
82
 
    def test_check_reports_bad_ancestor(self):
83
 
        repo = self.make_repo_with_extra_ghost_index()
84
 
        # XXX: check requires a non-empty revision IDs list, but it ignores the
85
 
        # contents of it!
86
 
        check_object = repo.check(['ignored'])
87
 
        check_object.report_results(verbose=False)
88
 
        self.assertContainsRe(self.get_log(),
89
 
            '1 revisions have incorrect parents in the revision index')
90
 
        check_object.report_results(verbose=True)
91
 
        self.assertContainsRe(
92
 
            self.get_log(),
93
 
            "revision-id has wrong parents in index: "
94
 
            r"\('incorrect-parent',\) should be \(\)")
95
 
 
96
 
 
97
43
class TestCallbacks(TestCaseWithRepository):
98
44
 
99
45
    def test_callback_tree_and_branch(self):