def process(self, commit): """Process a commit.""" if not self.check_allowed_origins(commit): return # Extract action and bugid from commit. action_list = utils.extract_actions(commit['message'], self.config['general']['extract_regex']) if not action_list: self.log.warning('Could not find any action/bugid in commit {id}.'.format(**commit)) return # Handle extracted actions for action, bugid in action_list: self.handle_extracted_action(action, bugid, commit)
def test_action_as_lower_str(self): self.assertListEqual([('fixes', 2)], utils.extract_actions('well (FiXES #2).', self.regex))
def test_action_empty(self): self.assertListEqual([('', 2)], utils.extract_actions('#2).', self.regex))
def test_bugid_empty(self): self.assertListEqual([], utils.extract_actions('ixes 18).', self.regex))
def test_multiple_values(self): self.assertListEqual([('fixes', 18), ('closes', 20)], utils.extract_actions('fixes #18 and closes:#20', self.regex))
def test_single_action(self): self.assertListEqual([('fixes', 18)], utils.extract_actions('comment (fixes: #18).', self.regex))
def test_empty_message(self): self.assertListEqual([], utils.extract_actions('', self.regex))