def get_changes(gitfrom=None): re_breaking = re.compile('BREAKING CHANGE: (.*)') for _hash, commit_message in get_commit_log(gitfrom): try: message = current_commit_parser()(commit_message) if message[1] not in changes: changes[message[1]] = [] print('Type {} is not supported?'.format(message[1])) changes[message[1]].append((_hash, message[2], message[3][0])) if message[3][1] and 'BREAKING CHANGE' in message[3][1]: parts = re_breaking.match(message[3][1]) if parts: changes['breaking'].append((_hash, parts.group(1))) if message[3][2] and 'BREAKING CHANGE' in message[3][2]: parts = re_breaking.match(message[3][2]) if parts: changes['breaking'].append((_hash, parts.group(1))) except UnknownCommitMessageStyleError: pass return changes
def test_current_commit_parser_should_return_correct_parser(self): self.assertEqual(current_commit_parser(), parser_angular.parse_commit_message)