18
18
"""Test operations that check the repository for corruption"""
20
20
from bzrlib import (
21
config as _mod_config,
22
21
revision as _mod_revision,
24
23
from bzrlib.tests.per_repository import TestCaseWithRepository
27
class TestNoSpuriousInconsistentAncestors(TestCaseWithRepository):
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'])
34
revid1 = tree.commit('1')
35
self.build_tree(['bar'])
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")
43
26
class TestCleanRepository(TestCaseWithRepository):
45
28
def test_new_repo(self):
46
repo = self.make_repository('foo')
48
self.addCleanup(repo.unlock)
49
config = _mod_config.Config()
29
branch = self.make_branch('foo')
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)