~bzr-pqm/bzr/bzr.dev

5557.1.7 by John Arbash Meinel
Merge in the bzr.dev 5582
1
# Copyright (C) 2007-2011 Canonical Ltd
2745.6.7 by Aaron Bentley
Clean-up
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2745.6.7 by Aaron Bentley
Clean-up
16
17
18
"""Test operations that check the repository for corruption"""
19
2745.6.1 by Aaron Bentley
Initial checking of knit graphs
20
from bzrlib import (
21
    revision as _mod_revision,
22
    )
3689.1.1 by John Arbash Meinel
Rename repository_implementations tests into per_repository tests
23
from bzrlib.tests.per_repository import TestCaseWithRepository
2819.2.1 by Andrew Bennetts
Implement KnitRepository._find_inconsistent_revision_parents.
24
25
4657.1.1 by Robert Collins
Do not add the root directory entry to the list of expected keys during check in non rich-root repositories. (#416732)
26
class TestCleanRepository(TestCaseWithRepository):
27
28
    def test_new_repo(self):
6127.1.1 by Jelmer Vernooij
Use Branch.get_commit_builder, as Repository.get_commit_builder without Branch breaks with bzr-svn.
29
        branch = self.make_branch('foo')
30
        branch.lock_write()
31
        self.addCleanup(branch.unlock)
5570.3.9 by Vincent Ladeuil
More use cases for overrideEnv, _cleanEnvironment *may* contain too much variables now.
32
        self.overrideEnv('BZR_EMAIL', 'foo@sample.com')
6351.3.3 by Jelmer Vernooij
Convert more stuff to use config stacks.
33
        builder = branch.get_commit_builder([], branch.get_config_stack())
4657.1.1 by Robert Collins
Do not add the root directory entry to the list of expected keys during check in non rich-root repositories. (#416732)
34
        list(builder.record_iter_changes(None, _mod_revision.NULL_REVISION, [
35
            ('TREE_ROOT', (None, ''), True, (False, True), (None, None),
36
            (None, ''), (None, 'directory'), (None, False))]))
37
        builder.finish_inventory()
38
        rev_id = builder.commit('first post')
6127.1.1 by Jelmer Vernooij
Use Branch.get_commit_builder, as Repository.get_commit_builder without Branch breaks with bzr-svn.
39
        result = branch.repository.check(None, check_repo=True)
4657.1.1 by Robert Collins
Do not add the root directory entry to the list of expected keys during check in non rich-root repositories. (#416732)
40
        result.report_results(True)
4794.1.15 by Robert Collins
Review feedback.
41
        log = self.get_log()
4657.1.1 by Robert Collins
Do not add the root directory entry to the list of expected keys during check in non rich-root repositories. (#416732)
42
        self.assertFalse('Missing' in log, "Something was missing in %r" % log)