~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-02-20 12:19:29 UTC
  • mfrom: (6437.23.11 2.5)
  • mto: (6581.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6582.
  • Revision ID: jelmer@samba.org-20120220121929-7ni2psvjoatm1yp4
Merge bzr/2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""Test operations that check the repository for corruption"""
19
19
 
20
20
from bzrlib import (
21
 
    config as _mod_config,
22
21
    revision as _mod_revision,
23
22
    )
24
23
from bzrlib.tests.per_repository import TestCaseWithRepository
25
24
 
26
25
 
27
 
class TestNoSpuriousInconsistentAncestors(TestCaseWithRepository):
28
 
 
29
 
    def test_two_files_different_versions_no_inconsistencies_bug_165071(self):
30
 
        """Two files, with different versions can be clean."""
31
 
        tree = self.make_branch_and_tree('.')
32
 
        self.build_tree(['foo'])
33
 
        tree.smart_add(['.'])
34
 
        revid1 = tree.commit('1')
35
 
        self.build_tree(['bar'])
36
 
        tree.smart_add(['.'])
37
 
        revid2 = tree.commit('2')
38
 
        check_object = tree.branch.repository.check([revid1, revid2])
39
 
        check_object.report_results(verbose=True)
40
 
        self.assertContainsRe(self.get_log(), "0 unreferenced text versions")
41
 
 
42
 
 
43
26
class TestCleanRepository(TestCaseWithRepository):
44
27
 
45
28
    def test_new_repo(self):
46
 
        repo = self.make_repository('foo')
47
 
        repo.lock_write()
48
 
        self.addCleanup(repo.unlock)
49
 
        config = _mod_config.Config()
 
29
        branch = self.make_branch('foo')
 
30
        branch.lock_write()
 
31
        self.addCleanup(branch.unlock)
50
32
        self.overrideEnv('BZR_EMAIL', 'foo@sample.com')
51
 
        builder = repo.get_commit_builder(None, [], config)
 
33
        builder = branch.get_commit_builder([], branch.get_config_stack())
52
34
        list(builder.record_iter_changes(None, _mod_revision.NULL_REVISION, [
53
35
            ('TREE_ROOT', (None, ''), True, (False, True), (None, None),
54
36
            (None, ''), (None, 'directory'), (None, False))]))
55
37
        builder.finish_inventory()
56
38
        rev_id = builder.commit('first post')
57
 
        result = repo.check(None, check_repo=True)
 
39
        result = branch.repository.check(None, check_repo=True)
58
40
        result.report_results(True)
59
41
        log = self.get_log()
60
42
        self.assertFalse('Missing' in log, "Something was missing in %r" % log)