36
36
tree = self.make_branch_and_tree('.')
37
37
self.build_tree(['foo'])
38
38
tree.smart_add(['.'])
39
revid1 = tree.commit('1')
40
40
self.build_tree(['bar'])
41
41
tree.smart_add(['.'])
43
# XXX: check requires a non-empty revision IDs list, but it ignores the
45
check_object = tree.branch.repository.check(['ignored'])
42
revid2 = tree.commit('2')
43
check_object = tree.branch.repository.check([revid1, revid2])
46
44
check_object.report_results(verbose=True)
47
45
log = self._get_log(keep_log_file=True)
48
self.assertContainsRe(
50
"0 unreferenced text versions")
46
self.assertContainsRe(log, "0 unreferenced text versions")
53
49
class TestFindInconsistentRevisionParents(TestCaseWithBrokenRevisionIndex):
100
96
"revision-id has wrong parents in index: "
101
97
r"\('incorrect-parent',\) should be \(\)")
100
class TestCallbacks(TestCaseWithRepository):
102
def test_callback_tree_and_branch(self):
103
# use a real tree to get actual refs that will work
104
tree = self.make_branch_and_tree('foo')
105
revid = tree.commit('foo')
107
self.addCleanup(tree.unlock)
109
for ref in tree._get_check_refs():
110
needed_refs.setdefault(ref, []).append(tree)
111
for ref in tree.branch._get_check_refs():
112
needed_refs.setdefault(ref, []).append(tree.branch)
113
self.tree_check = tree._check
114
self.branch_check = tree.branch.check
115
tree._check = self.tree_callback
116
tree.branch.check = self.branch_callback
118
tree.branch.repository.check([revid], callback_refs=needed_refs)
119
self.assertNotEqual([], self.callbacks)
121
def tree_callback(self, refs):
122
self.callbacks.append(('tree', refs))
123
return self.tree_check(refs)
125
def branch_callback(self, refs):
126
self.callbacks.append(('branch', refs))
127
return self.branch_check(refs)