1
# Copyright (C) 2007 Canonical Ltd
1
# Copyright (C) 2007, 2009 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
"""Tests for the 'check' CLI command."""
34
34
tree = self.make_branch_and_tree('.')
35
35
tree.commit('hallelujah')
36
36
out, err = self.run_bzr('check')
37
self.assertContainsRe(err, r"^Checking working tree at '.*'\.\n"
38
r"Checking repository at '.*'\.\n"
39
r"checked repository.*\n"
37
self.assertContainsRe(err, r"Checking working tree at '.*'\.\n")
38
self.assertContainsRe(err, r"Checking repository at '.*'\.\n")
39
# the root directory may be in the texts for rich root formats
40
self.assertContainsRe(err, r"checked repository.*\n"
42
r" 0 unique file texts\n"
43
r" 0 repeated file texts\n"
44
r" 0 unreferenced text versions\n"
45
r"Checking branch at '.*'\.\n"
46
r"checked branch.*\n$")
44
self.assertContainsRe(err, r"Checking branch at '.*'\.\n")
45
self.assertContainsRe(err, r"checked branch.*")
48
47
def test_check_branch(self):
49
48
tree = self.make_branch_and_tree('.')
51
50
out, err = self.run_bzr('check --branch')
52
51
self.assertContainsRe(err, r"^Checking branch at '.*'\.\n"
53
r"checked branch.*\n$")
55
54
def test_check_repository(self):
56
55
tree = self.make_branch_and_tree('.')
59
58
self.assertContainsRe(err, r"^Checking repository at '.*'\.\n"
60
59
r"checked repository.*\n"
63
r" 0 unique file texts\n"
64
r" 0 repeated file texts\n"
65
r" 0 unreferenced text versions$")
67
64
def test_check_tree(self):
68
65
tree = self.make_branch_and_tree('.')
76
73
out, err = self.run_bzr('check --tree --branch')
77
74
self.assertContainsRe(err, r"^Checking working tree at '.*'\.\n"
78
75
r"Checking branch at '.*'\.\n"
79
r"checked branch.*\n$")
81
78
def test_check_missing_tree(self):
82
79
branch = self.make_branch('.')
87
84
branch = self.make_branch('.')
88
85
out, err = self.run_bzr('check --tree --branch')
89
86
self.assertContainsRe(err,
90
r"^No working tree found at specified location\.\n"
91
87
r"Checking branch at '.*'\.\n"
92
r"checked branch.*\n$")
88
r"No working tree found at specified location\.\n"
94
91
def test_check_missing_branch_in_shared_repo(self):
95
92
self.make_repository('shared', shared=True)