41
41
versioned_change='unchanged', renamed=False,
42
42
modified='unchanged', exe_change=False,
43
43
kind=('file', 'file'), old_path=None,
44
unversioned_filter=None):
44
unversioned_filter=None, view_info=None):
48
expected_lines = [expected]
49
self.assertReportLines(expected_lines, file_id, path,
50
versioned_change, renamed,
53
unversioned_filter, view_info)
55
def assertReportLines(self, expected_lines, file_id='fid', path='path',
56
versioned_change='unchanged', renamed=False,
57
modified='unchanged', exe_change=False,
58
kind=('file', 'file'), old_path=None,
59
unversioned_filter=None, view_info=None):
46
61
def result_line(format, *args):
47
62
result.append(format % args)
48
63
reporter = _mod_delta._ChangeReporter(result_line,
49
unversioned_filter=unversioned_filter)
64
unversioned_filter=unversioned_filter, view_info=view_info)
50
65
reporter.report(file_id, (old_path, path), versioned_change, renamed,
51
66
modified, exe_change, kind)
52
if expected is not None:
53
self.assertEqualDiff(expected, result[0])
67
if expected_lines is not None:
68
for i in range(len(expected_lines)):
69
self.assertEqualDiff(expected_lines[i], result[i])
55
71
self.assertEqual([], result)
107
123
renamed=False, modified='created', exe_change=False,
108
124
kind=(None, 'file'), unversioned_filter=lambda x:True)
126
def test_view_filtering(self):
127
# If a file in within the view, it should appear in the output
129
"Operating on whole tree but only reporting on 'my' view.",
131
self.assertReportLines(expected_lines, modified='modified',
132
view_info=('my',['path']))
133
# If a file in outside the view, it should not appear in the output
135
"Operating on whole tree but only reporting on 'my' view."]
136
self.assertReportLines(expected_lines, modified='modified',
137
path="foo", view_info=('my',['path']))
110
139
def assertChangesEqual(self,
112
141
paths=('path', 'path'),