def __init__(self, host, changelog_paths): self._changelog_paths = changelog_paths self._filesystem = host.filesystem self._contribution_areas = ContributionAreas(host.filesystem) self._scm = host.scm() self._parsed_revisions = {} self._contributors_statistics = {} self._areas_statistics = dict([(area, {'reviewed': 0, 'unreviewed': 0, 'contributors': {}}) for area in self._contribution_areas.names()]) self._summary = {'reviewed': 0, 'unreviewed': 0} self._longest_filename = max([len(path) - len(self._scm.checkout_root) for path in changelog_paths]) self._filename = '' self._length_of_previous_output = 0
def test_areas_for_touched_files(self): areas = ContributionAreas(MockFileSystem(), [ _Area('CSS'), _Area('HTML'), _Area('Forms', ['forms', 'input']), _Area('CSS Transforms', [_Intersection('css', 'transforms')]), ]) self._assert_areas_for_touched_files(areas, [], []) self._assert_areas_for_touched_files(areas, ['WebCore/css'], ['CSS']) self._assert_areas_for_touched_files(areas, ['WebCore/html/'], ['HTML']) self._assert_areas_for_touched_files(areas, [ 'WebCore/css/CSSStyleSelector.cpp', 'WebCore/html/HTMLIFrameElement.h' ], ['CSS', 'HTML']) self._assert_areas_for_touched_files(areas, ['WebCore'], []) self._assert_areas_for_touched_files(areas, ['WebCore/html2'], []) self._assert_areas_for_touched_files( areas, ['WebCore/html/HTMLInputElement.cpp'], ['HTML', 'Forms']) self._assert_areas_for_touched_files(areas, ['WebCore/svg/transforms'], []) self._assert_areas_for_touched_files(areas, ['WebCore/css/transforms'], ['CSS', 'CSS Transforms'])