diff --git a/stackalytics/processor/vcs.py b/stackalytics/processor/vcs.py index 05864f8f6..b25ebee31 100644 --- a/stackalytics/processor/vcs.py +++ b/stackalytics/processor/vcs.py @@ -74,7 +74,7 @@ MESSAGE_PATTERNS = { 'blueprint_id': re.compile(r'\b(?:blueprint|bp)\b[ \t]*[#:]?[ \t]*' r'(?P[a-z0-9-]+)', re.IGNORECASE), 'change_id': re.compile('Change-Id: (?PI[0-9a-f]{40})', re.IGNORECASE), - 'coauthor': re.compile(r'(?:Co-Authored|Also)-By:' + 'coauthor': re.compile(r'(?:Co-Authored-By|Also-By|Co-Author):' r'\s*(?P%s)\s' % CO_AUTHOR_PATTERN_RAW, re.IGNORECASE) } diff --git a/tests/unit/test_vcs.py b/tests/unit/test_vcs.py index 8c08f6891..5b636c8a7 100644 --- a/tests/unit/test_vcs.py +++ b/tests/unit/test_vcs.py @@ -122,13 +122,28 @@ Also-By: Bob Dylan Also-By: Anonymous Also-By: Winnie the Pooh winnie222@openstack.org +diff_stat: + + 0 files changed, 0 insertions(+), 0 deletions(-) +commit_id:d1af9cbe0187e1a65cf1eb46fb1650cf619a7b3a +date:1369831300 +author_name:Vasya Pupkin +author_email:vpupkinx@openstack.com +subject:adds new support of co-authors +message:Change-Id: I577dfdf7f65a0c883ddbcfda62daf8c5f9c746c1 +Co-Authored-By: Tupac Shakur +Also: Bob Dylan +Co-Authored: Anonymous +Co-Author-By: Anonymous2 +Co-Author: Winnie the Pooh winnie222@openstack.org + diff_stat: 0 files changed, 0 insertions(+), 0 deletions(-) ''' commits = list(self.git.log('dummy', 'dummy')) - commits_expected = 7 + commits_expected = 8 self.assertEqual(commits_expected, len(commits)) self.assertEqual(21, commits[0]['files_changed']) @@ -177,3 +192,28 @@ diff_stat: {'author_name': 'Winnie the Pooh', 'author_email': 'winnie222@openstack.org'}, commits[6]['coauthor']) + + self.assertIn( + {'author_name': 'Tupac Shakur', + 'author_email': 'tupac.shakur@openstack.com'}, + commits[7]['coauthor']) + + self.assertNotIn( + {'author_name': 'Bob Dylan', + 'author_email': 'bob.dylan@openstack.com'}, + commits[7]['coauthor']) + + self.assertNotIn( + {'author_name': 'Anonymous', + 'author_email': 'correct@email.com'}, + commits[7]['coauthor']) + + self.assertNotIn( + {'author_name': 'Anonymous2', + 'author_email': 'correct@email2.com'}, + commits[7]['coauthor']) + + self.assertIn( + {'author_name': 'Winnie the Pooh', + 'author_email': 'winnie222@openstack.org'}, + commits[7]['coauthor'])