~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge bug fix for check - do not consider non rich root tree roots to have repository data during check. (Robert Collins, bug 416732)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Test operations that check the repository for corruption"""
19
19
 
 
20
import os
20
21
 
21
22
from bzrlib import (
 
23
    check,
 
24
    config as _mod_config,
22
25
    errors,
 
26
    inventory,
23
27
    revision as _mod_revision,
24
28
    )
25
29
from bzrlib.tests import TestNotApplicable
125
129
    def branch_callback(self, refs):
126
130
        self.callbacks.append(('branch', refs))
127
131
        return self.branch_check(refs)
 
132
 
 
133
 
 
134
class TestCleanRepository(TestCaseWithRepository):
 
135
 
 
136
    def test_new_repo(self):
 
137
        repo = self.make_repository('foo')
 
138
        repo.lock_write()
 
139
        self.addCleanup(repo.unlock)
 
140
        config = _mod_config.Config()
 
141
        os.environ['BZR_EMAIL'] = 'foo@sample.com'
 
142
        builder = repo.get_commit_builder(None, [], config)
 
143
        list(builder.record_iter_changes(None, _mod_revision.NULL_REVISION, [
 
144
            ('TREE_ROOT', (None, ''), True, (False, True), (None, None),
 
145
            (None, ''), (None, 'directory'), (None, False))]))
 
146
        builder.finish_inventory()
 
147
        rev_id = builder.commit('first post')
 
148
        result = repo.check(None, check_repo=True)
 
149
        result.report_results(True)
 
150
        log = self._get_log(keep_log_file=True)
 
151
        self.assertFalse('Missing' in log, "Something was missing in %r" % log)